Tuesday, 20 August 2013

Error handling between button and bean method

Error handling between button and bean method

I have a jsf button that calls a bean method called generateLicense. This
bean method returns a string to perform a redirect, like this
"/licenseGenerated.xhtml?faces-redirect=true"
This method is supposed to do several back-end calls based on the user's
input. Now, this means that in I have to add some error handling. Here's
the behavior I need.
The user accesses the application and is in the main.xhtml page. The user
inputs the value and clicks the button. If the whole procedure works
correctly, then the user should be redirected to the
/licenseGenerated.xhtml page. Otherwise, in case an error happened, I
don't need a redirect. What I need is to render a jsf component that
contains an error message on the main.xhtml page.
So, what should the generateLicense method return in case of an error, and
what would the button's jsf code be like?
Thanks for the help!

No comments:

Post a Comment