You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Harry Co <ha...@gmail.com> on 2006/10/03 16:57:45 UTC

t:commandLink for navigation but browser url not changed

Hi all,

I facing some odd behaviour using t:commandLink.

On my my page, I have a t:commandLink leading to a second page via
navigation rule configuration

When I click the link, the proper view is displayed but the url *displayed
by the browser doe not change *(ex: when clicked from the home page
http://localhost:8080/myApp/index.faces, I navigate to contacts.xhtml view
but url still http://localhost:8080/myApp/index.faces ).


My nav-rules are quite simple:

 <navigation-case>
>
>       <from-outcome>nav.home</from-outcome>
>
>       <to-view-id>/index.xhtml</to-view-id>
>
> </navigation-case>
>
>  <navigation-case>
>
> <from-outcome>nav.contacts</from-outcome>
>
> <to-view-id>/contacts.xhtml</to-view-id>
>
> </navigation-case>
>
 Have you faced this?
 I'm using facelets 1.1.4 whith myfaces 1.1.3 tomahawk 1.1.2.

Any suggestion is welcome!

TIA
Harry.

Re: t:commandLink for navigation but browser url not changed

Posted by Harry Co <ha...@gmail.com>.
Great!!!
You're totally right Andrew!!! I've forgotten the redirect option.
Everything is working fine!!
Silly of me!!! ;-)
Thanks so much and thanks again for the quick and straight answer.

Harry.


2006/10/3, Andrew Robinson <an...@gmail.com>:
>
> Sounds like everything is working fine.
>
> The browser retains the URL of the page it posted to (the action of
> the HTML FORM element). JSF doesn't load the next view until AFTER
> your action has been executed and the navigation rules are processed.
>
> 1) page is rendered
> 2) user submits the form to the CURRENT URL
> 3) view is re-loaded
> 4) validation (if not valid, return the current page to the user, URL
> & view are not changed)
> 5) Update model
> 6) process action (if navigation rule is not found, return the current
> page to the user, URL & view are not changed)
> 7) Either send a redirect to the user or render the new page to the user
>
> If the rule was a redirect, the user is redirected to the new URL of
> the new JSF view and the URL is updated in the browser.
>
> If the rule is "normal," the browser remains on the same page it
> posted to (the previous URL). The component state of JSF however is on
> a different view-id and that is why the next post knows which view to
> load.
>
> In summary:
>
> URL != View ID
>
> There are many WIKI entries and posts discussing this and different
> ways of handling this based on your needs.
>
> -Andrew
>
> On 10/3/06, Harry Co <ha...@gmail.com> wrote:
> > Hi all,
> >
> > I facing some odd behaviour using t:commandLink.
> >
> > On my my page, I have a t:commandLink leading to a second page via
> > navigation rule configuration
> >
> > When I click the link, the proper view is displayed but the url
> displayed by
> > the browser doe not change (ex: when clicked from the home page
> > http://localhost:8080/myApp/index.faces , I navigate to
> > contacts.xhtml view but url still
> > http://localhost:8080/myApp/index.faces ).
> >
> >
> > My nav-rules are quite simple:
> >
> >
> > >
> > >
> > > <navigation-case >
> > >
> > >       < from-outcome> nav.home</ from-outcome>
> > >
> > >       < to-view-id> /index.xhtml</ to-view-id>
> > >
> > > </ navigation-case>
> >
> >
> >
> >
> >
> >
> >
> >
> > <navigation-case>
> >
> >  <from-outcome>nav.contacts</from-outcome>
> >
> >  <to-view-id>/contacts.xhtml</to-view-id>
> >
> > </navigation-case>
> >
> >
> >
> >
> > Have you faced this?
> >  I'm using facelets 1.1.4 whith myfaces 1.1.3 tomahawk 1.1.2.
> >
> > Any suggestion is welcome!
> >
> > TIA
> > Harry.
> >
> >
>

Re: t:commandLink for navigation but browser url not changed

Posted by Andrew Robinson <an...@gmail.com>.
Check the archives of this list. I don't have any links. I just know
that this topic has been brought up many times. In fact, a good
resource is the Java tutorial on Sun's web site. Just review the Java
lifecycle and the navigation handler.

On 10/3/06, Aneesha Govil <po...@gmail.com> wrote:
>
>
> On 10/3/06, Andrew Robinson <an...@gmail.com> wrote:
> > In summary:
> >
> > URL != View ID
> >
> > There are many WIKI entries and posts discussing this and different
> > ways of handling this based on your needs.
> >
> > -Andrew
>
> Can you give me some links to those resources? I can't find any, I suppose
> you mean the myfaces wiki.
>
> Thanks,
> Aneesha
>

Re: t:commandLink for navigation but browser url not changed

Posted by Aneesha Govil <po...@gmail.com>.
On 10/3/06, Andrew Robinson <an...@gmail.com> wrote:
>
> In summary:
>
> URL != View ID
>
> There are many WIKI entries and posts discussing this and different
> ways of handling this based on your needs.
>
> -Andrew


Can you give me some links to those resources? I can't find any, I suppose
you mean the myfaces wiki.

Thanks,
Aneesha

Re: t:commandLink for navigation but browser url not changed

Posted by Andrew Robinson <an...@gmail.com>.
Sounds like everything is working fine.

The browser retains the URL of the page it posted to (the action of
the HTML FORM element). JSF doesn't load the next view until AFTER
your action has been executed and the navigation rules are processed.

1) page is rendered
2) user submits the form to the CURRENT URL
3) view is re-loaded
4) validation (if not valid, return the current page to the user, URL
& view are not changed)
5) Update model
6) process action (if navigation rule is not found, return the current
page to the user, URL & view are not changed)
7) Either send a redirect to the user or render the new page to the user

If the rule was a redirect, the user is redirected to the new URL of
the new JSF view and the URL is updated in the browser.

If the rule is "normal," the browser remains on the same page it
posted to (the previous URL). The component state of JSF however is on
a different view-id and that is why the next post knows which view to
load.

In summary:

URL != View ID

There are many WIKI entries and posts discussing this and different
ways of handling this based on your needs.

-Andrew

On 10/3/06, Harry Co <ha...@gmail.com> wrote:
> Hi all,
>
> I facing some odd behaviour using t:commandLink.
>
> On my my page, I have a t:commandLink leading to a second page via
> navigation rule configuration
>
> When I click the link, the proper view is displayed but the url displayed by
> the browser doe not change (ex: when clicked from the home page
> http://localhost:8080/myApp/index.faces , I navigate to
> contacts.xhtml view but url still
> http://localhost:8080/myApp/index.faces ).
>
>
> My nav-rules are quite simple:
>
>
> >
> >
> > <navigation-case >
> >
> >       < from-outcome> nav.home</ from-outcome>
> >
> >       < to-view-id> /index.xhtml</ to-view-id>
> >
> > </ navigation-case>
>
>
>
>
>
>
>
>
> <navigation-case>
>
>  <from-outcome>nav.contacts</from-outcome>
>
>  <to-view-id>/contacts.xhtml</to-view-id>
>
> </navigation-case>
>
>
>
>
> Have you faced this?
>  I'm using facelets 1.1.4 whith myfaces 1.1.3 tomahawk 1.1.2.
>
> Any suggestion is welcome!
>
> TIA
> Harry.
>
>