aspose file tools*
The moose likes JSF and the fly likes Navigation problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Navigation problem" Watch "Navigation problem" New topic
Author

Navigation problem

Asheesh Nehra
Ranch Hand

Joined: Jun 25, 2009
Posts: 35
Hello

I am new to JSF .... i have a problem ..... i have simple three pages index.jsp , input.jsp and greeting.jsp. I am forwarding to input.jsp from index.jsp. Because of <jsp:forward> url does not changes and controls goes to input.jsp.
Now problem is that when i click on the button in the input.jsp it does not work, If i access the input.jsp(input.faces) then it works fine.

If i dont want to disclose the input.jsp then how can i achieve this ?

Thanks
Marcin Majewski
Greenhorn

Joined: Dec 20, 2010
Posts: 14

While in JSF world we use rather the navigation concept. In faces-config.xml you can define the so called navigation rules that are responsible for application page flow. I.e. we have two jsps: index.jsp and about.jsp. Let's assume that inside index.jsp we have defined a <h:commandLink value="Go to about" action="about"/> component. Now in faces-config.xml we define



Now, after clicking this link you'll be directed to about.jsp page. You can read more about this concept at http://www.jsftutorials.net/jsf-navigation-by-examples.html


Check out my site at whizzarts.pl
Asheesh Nehra
Ranch Hand

Joined: Jun 25, 2009
Posts: 35
Thanks Marcin Majewski for your reply and giving me the so informative link about the navigation rules.
But my question is if i access a page while forwarding through another page then url is the first not the forwarded page. How this can be matched while url showing the index.faces?
Marcin Majewski
Greenhorn

Joined: Dec 20, 2010
Posts: 14

Can you please attach the source code.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16141
    
  21

In JSF, the URL isn't always pointing to the current page. That's because a URL is a resource locator. It is NOT a "file location".

In most systems, the URL does act like a "file locator" to some degree or other, but JSF uses an extensive postback mechanism so that doesn't work. You should consider the URL to be more of a "session handle" than an absolute indicate of which view resource is being displayed.


Customer surveys are for companies who didn't pay proper attention to begin with.
Asheesh Nehra
Ranch Hand

Joined: Jun 25, 2009
Posts: 35
Marcin Majewski here is the code

index.jsp


Now when i have the url http://localhost:8080/test/index.faces then click event of the button in the input.jsp does not work. but if i have the url http://localhost:8080/test/input.faces then click event of the button in the input.jsp does work.
Marcin Majewski
Greenhorn

Joined: Dec 20, 2010
Posts: 14

Ok. I assume that you're trying to define a default page that should appear after entering your application URL. There's a better solution than forwarding. You can define the following in your web.xml configuration file:

Hope it solves your problem with not calling the button action as well.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Navigation problem