After the user fills my backing bean with info through the forms, I want to process the instance in Java code (such as JAXB marshalling).
So at the moment i'm doing this like so:
<% OtherBean.method(myBackingBean); %>
which is – if i'm right – not quite an up to date solution 🙂 So how can I make this happen in a 'better' way?
Thanks in advance,
Daniel.
Best Solution
One solution is to add an action method to the bean - it is possible to have it process itself.
For example, this simple bean:
...defined in WEB-INF/faces-config.xml:
...can be processed using the this JSP:
Note the method binding #{simpleBean.processData}. This must be a public method that takes no arguments and returns a String argument (which can be used for page navigation if desired).
This isn't the only way to go about this, but it is fairly straightforward.