0

REDIRECTING WITH BOOKMARK

asked 2012-10-22 10:39:23 +0800

shivam gravatar image shivam
66

I have a page with a tabbox ... on the click of each tab in the tabbox I am adding a bookmark in the desktop

if the user clicks on tab2 the url will be
http://localhost:8080/SampleApp/homepage.zul#tab2

Now what I want is if the user hits on the above url.... tab2 should be selected by default( which I did by listening on onBookmarkChange)

But suppose if the user is not logged in I first redirect the user to login page in the doBeforeCompose of homepage.zul's composer and I set the execution's voided property to true( setting executions voided property to true is imp :( (without this i guess the problem can be solved)) and then I again want to redirect him to "http://localhost:8080/SampleApp/homepage.zul#tab2" in the login page's composer.

I am facing problems in again redirecting the user to the above written url.

pls help

calling request.getRequestURL() in homepages doBeforeCompose returns only this much "http://localhost:8080/SampleApp/homepage.zul" it doesnt include the #tab2 part.

as per me its not possible untill I dont allow the homepage to be rendered completely( by not setting voided to true)

delete flag offensive retag edit

10 Replies

Sort by ยป oldest newest

answered 2012-10-22 14:13:47 +0800

shivam gravatar image shivam
66

ppl please pour in your thoughts ..... if any additional info is required let me know :)

link publish delete flag offensive edit

answered 2012-10-22 15:38:07 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

Do you mean you are trying to have an history so that next time the user logs in it opens the desired (=last visited) tab?
I am afraid it is not possible unless you persist somehow the necessary information.

link publish delete flag offensive edit

answered 2012-10-22 17:26:04 +0800

shivam gravatar image shivam
66

I will try to explain my use case in the following steps
1. User is not logged in
2. User directly hits on this url( no history he just types)
http://somehost:8080/homepage.zul#someBookmark
3. Since a user needs to login before viewing homepage i redirect him to login page
4. User logs in
5. Now i want to redirect him to the original url he typed
http://somehost:8080/homepage.zul#someBookmark

I hope this makes things clearer

link publish delete flag offensive edit

answered 2012-10-23 07:57:07 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

Ah ok, then I was nearly right.
And what happens is that the tab is not actually opened... you might maybe get the request by code, extract the part after #, keep it somehow and then by code open the tab once you access the desired page, I am afraid it could be an http request issue, not a ZK issue...

link publish delete flag offensive edit

answered 2012-10-23 09:19:08 +0800

shivam gravatar image shivam
66

thank you for helping steve ..... i think the above functionality cannot be achieved untill I dont allow the homepage to be rendered completely and after that redirect the user to login page .... as after the page is rendered a second request is sent to the server which contains the bookmark info .... anyways I will have to look for some workaround :)

link publish delete flag offensive edit

answered 2012-10-23 11:49:08 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

Mmmmmh... BTW, have u tried to open a tab simply by passing the #-marked url? does it works? ZK uses the annotation to manage tabs, but it could "wrap" behaviour somehow... not sure it works simply like this.
If redirect to login is managed by security constraints, if you apply a composer to the tabbox you should be able to parse the incoming request...?
Executions.getCurrent().getNativeRequest() etc.etc.?
Sorry for not solving....

link publish delete flag offensive edit

answered 2012-10-24 13:20:10 +0800

shivam gravatar image shivam
66

Ya steve on directly hitting a url with # info and no redirecting it takes me to the correct tab.....

What i feel is happening is
When we hit a url containing #
After the page renders a js executes .... the js gets the # related info from browser then it fires the onBookmarkChange event from client side ..... hence we have to let the page render completely


The # info is available only in js cant be accessed on server side as far as i know

link publish delete flag offensive edit

answered 2012-10-30 16:20:21 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

Yes, exactly... it is not part of the request.
Another approach: where does the use type the desired address? in the url browser bar? what about having him/her typing in a textbox binded to an object, which can be then retrieved and used for redirection after the page has been rendered?
If you get the solution, please remember to post it!

link publish delete flag offensive edit

answered 2012-10-30 18:48:33 +0800

shivam gravatar image shivam
66

Hi Steve.......things will work according to the approach u r suggesting...

I wasnt able to solve d problem completely but i found sort of a workaround
In my case the user will directly type the url into the browser
This is my workaround
1 user hits on the url
2 in the dobeforecomposer of the page i see user is not logged in
3 instead of redirecting i forward the request to login page
4 even though i have forwarded the request in dobeforecompose of the page i still receive the onBookmarkChangeEvent( this doesnt happen when u redirect)
5 in the listener for onBookmarChange i put the bookmark onto the native session and also the url without the # part
6 in the login pages composer after the user logs in I get the url and the bookmark... i append a # and the bookmark on the url and redirect him


I hope you got what i am trying to say sorry fir my bad english

link publish delete flag offensive edit

answered 2012-10-31 09:39:39 +0800

Steva77 gravatar image Steva77 flag of Italy
1014 3
http://www.research.softe...

Yes, got it, happy u found a solution somehow,
be well
S

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-10-22 10:39:23 +0800

Seen: 163 times

Last updated: Oct 31 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More