• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Navigation problem

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 14
IntelliJ IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Asheesh Nehra
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 14
IntelliJ IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please attach the source code.
 
Saloon Keeper
Posts: 28494
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Asheesh Nehra
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 14
IntelliJ IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic