You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by arne anka <do...@ginguppin.de> on 2008/04/02 16:51:52 UTC

navigation/form: wrong url displayed in browser

hi,
i created three pages:
/index.jspx
/search/search_simple.jspx
/search/search_results.jspx

index.jspx contains a jscookmenu directing to search_simple.jspx (by  
navigation-rule), search_simple.jspx sends a form to a backing bean which  
in turn (by navigation-rule) directs to search_results.jspx.
surfing to

http://localhost/foo/

renders index.jspx, chosing search_simple.jspx from the menu renders the  
page (search_simple.jspx) correctly -- but the browser now shows

http://localhost/foo/index.jsf

in the url field.

submitting the rendered formular directs to search_results.jspx -- but now  
the url filed shows

http://localhost/foo/search_simple.jsf

ie the url displayed is always one page behind.
i am sure it is some kind of beginners fault but i do not find any hints  
how to solve, so please -- how do i correct that?

i would happily get rid of the whole url thing (ie the browser could  
always show http://localhost/foo/ regardless what page is rendered), but  
if the url is displayed it should be the right one.


regards

Re: navigation/form: wrong url displayed in browser

Posted by simon <si...@chello.at>.
On Wed, 2008-04-02 at 17:15 +0200, arne anka wrote:
> > See here:
> >   http://wiki.apache.org/myfaces/FAQ#StaleLink
> 
> ah, thanks a lot.
> but, alas, it is more like a better description of the problem with two  
> proposals to work around but no real solution.
> i would think a lot of people is bothered by this ...
> 
> not real myfaces: but is there a way to configure an apache+tomcat+jk2 so  
> the url is _always_ http://localhost/foo/?

The thing is that a lot of clever people have thought about this, and
not been able to come up with a way for an app to:
(a) use forwarding internally for efficiently, and
(b) show the url of the "current page".

Http simply does not support this. It's not a JSF issue, it's something
that any webapp that does forwarding internally will face. If there was
a solution, it would have been implemented by now.

The only *known* solution is to use http "forwarding" instead of
internal forwards, as explained on that page. But as the page explains,
it does have other problems.

Simple apps (those whose params are guaranteed to fit in a GET query's
params) can avoid this, but that is just not the niche that JSF lives
in.

Perhaps we (stateful webapp writers) should be more involved with the W3
and WhatWG groups to push for the features that we need to make this
work properly. But even if successful, that would take years to be
effective.

Regards,
Simon


Re: navigation/form: wrong url displayed in browser

Posted by Volker Weber <v....@inexso.de>.
Hi,

you can made the welcome-file a frameset, to hide the real inner urls.


Regards,
    Volker

2008/4/2, arne anka <do...@ginguppin.de>:
> > See here:
> >  http://wiki.apache.org/myfaces/FAQ#StaleLink
> >
>
>  ah, thanks a lot.
>  but, alas, it is more like a better description of the problem with two
> proposals to work around but no real solution.
>  i would think a lot of people is bothered by this ...
>
>  not real myfaces: but is there a way to configure an apache+tomcat+jk2 so
> the url is _always_ http://localhost/foo/?
>


-- 
inexso - information exchange solutions GmbH
Bismarckstraße 13      | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX:  +49 441 4082 355 | www.inexso.de

Re: navigation/form: wrong url displayed in browser

Posted by arne anka <do...@ginguppin.de>.
> See here:
>   http://wiki.apache.org/myfaces/FAQ#StaleLink

ah, thanks a lot.
but, alas, it is more like a better description of the problem with two  
proposals to work around but no real solution.
i would think a lot of people is bothered by this ...

not real myfaces: but is there a way to configure an apache+tomcat+jk2 so  
the url is _always_ http://localhost/foo/?

Re: navigation/form: wrong url displayed in browser

Posted by "simon.kitching@chello.at" <si...@chello.at>.
arne anka schrieb:
> hi,
> i created three pages:
> /index.jspx
> /search/search_simple.jspx
> /search/search_results.jspx
>
> index.jspx contains a jscookmenu directing to search_simple.jspx (by
> navigation-rule), search_simple.jspx sends a form to a backing bean
> which in turn (by navigation-rule) directs to search_results.jspx.
> surfing to
>
> http://localhost/foo/
>
> renders index.jspx, chosing search_simple.jspx from the menu renders
> the page (search_simple.jspx) correctly -- but the browser now shows
>
> http://localhost/foo/index.jsf
>
> in the url field.
>
> submitting the rendered formular directs to search_results.jspx -- but
> now the url filed shows
>
> http://localhost/foo/search_simple.jsf
>
> ie the url displayed is always one page behind.
> i am sure it is some kind of beginners fault but i do not find any
> hints how to solve, so please -- how do i correct that?
>
> i would happily get rid of the whole url thing (ie the browser could
> always show http://localhost/foo/ regardless what page is rendered),
> but if the url is displayed it should be the right one.


See here:
  http://wiki.apache.org/myfaces/FAQ#StaleLink

Regards, Simon


Re: navigation/form: wrong url displayed in browser

Posted by Stephen Friedrich <tr...@eekboom.com>.
You can't always show the same URL, but using the redirect-after-post pattern (similar
to the first solution sketched briefly in the myfaces wiki), is a standard solution.
Not only does it solve the "one-url-behind-problem", but it solves the problem of stupid
browser warnings when the user tries to refresh the page (e.g. presses f5).

See here for a nice article:
http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost

Propagation of request parameters and faces messages is indeed a problem.
JBoss Seam solves this quite nicely using page scoped parameters and conversations.
I am not sure about the apache pendant "orchestra".

arne anka wrote:
> hi,
> i created three pages:
> /index.jspx
> /search/search_simple.jspx
> /search/search_results.jspx
> 
> index.jspx contains a jscookmenu directing to search_simple.jspx (by 
> navigation-rule), search_simple.jspx sends a form to a backing bean 
> which in turn (by navigation-rule) directs to search_results.jspx.
> surfing to
> 
> http://localhost/foo/
> 
> renders index.jspx, chosing search_simple.jspx from the menu renders the 
> page (search_simple.jspx) correctly -- but the browser now shows
> 
> http://localhost/foo/index.jsf
> 
> in the url field.
> 
> submitting the rendered formular directs to search_results.jspx -- but 
> now the url filed shows
> 
> http://localhost/foo/search_simple.jsf
> 
> ie the url displayed is always one page behind.
> i am sure it is some kind of beginners fault but i do not find any hints 
> how to solve, so please -- how do i correct that?
> 
> i would happily get rid of the whole url thing (ie the browser could 
> always show http://localhost/foo/ regardless what page is rendered), but 
> if the url is displayed it should be the right one.
> 
> 
> regards