Forums Register Login

How to know the outcome of backing bean method

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
Poop goes in a willow feeder. Wipe with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1852 times.
Similar Threads
how to use managed bean property in navigation rule tag of faces config.
EL in views and outcomes?
commandLink param problem
Problem with navigation rule!
JSF action doesn't call bean method
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:19:38.