-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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)
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.
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
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...
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 :)
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....
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
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!
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
Yes, got it, happy u found a solution somehow,
be well
S
Asked: 2012-10-22 10:39:23 +0800
Seen: 163 times
Last updated: Oct 31 '12