• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to know the outcome of backing bean method

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have called a managed bean which returns a string "GO_NEXT". I have added a navigation case in the faces-config.xml file for the same.



But still request is not forwarded to test.jsp.
How can I know whether the case I have given in the config file is correct or how I can print what saveDetails method has returned.
 
Saloon Keeper
Posts: 27762
196
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
You can probably crank up the log levels for your JSF implementation and see the gory details, but I rarely get that desperate. The mechanism "just works", except when it doesn't, and then you don't usually get any error messages.

Several things can mess you up.

1. If the action method is never called, obviously it won't navigate. So you can put a trace print message in the action method to make sure it called. Or set a debugger breakpoint. The action method will only be called if all fields in the submitted form pass validation, so an "h:messages" tag on the page can point out any validation errors.

2. If there's no navigation handler for the outcome you indicate, it won't navigate. Not a problem in your case, though unless I missed something.

3. If the destination URL does not exist, it won't navigate. Note that I said URL and not "page definition", "file", or "resource". That's because JSF navigation is to a URL and URLs are NOT the same thing as files.

4. If the destination is not a JSF URL, it won't navigate. You can't pass from JSF to a JSP, for example using navigation. If the JSF page needs to advance to a JSP or servlet or non-JSF URL such as Struts, you can't do that in the action method via navigation. You'll have to do a forward in the action processor or use a "h:outputLink", depending on whether or not you have action processing to do.
 
Ravi Mirani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply.
I have created 2 jsp files. /test.jsp and company/x/y/firstview.jsp. On test.jsp I have provide a link and called method of ManagedBean which returns a string and navigates to company/x/y/firstview.jsp (using faces-config.xml). This works fine.
On firstview.jsp, I have used JSF tags and fileds (i.e. radio buttons, button etc) and are linked with managed bean. I have also provided a button on firstview.jsp which calls the action method of managed bean and as per business logic it should get navigated back to test.jsp.
Action method is called successfully, but the page is not navigated.
Can you please more detail on Point 4 that you have mentioned, or provide an external URL for detail reference.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic