I have a html hyperlink in a web page, <a href="1.jsf">Home</a>,
The problem is, when i click on the hyperlink, the control should be redirected to a jsf bean method, perform some computations and then again the control should be transferred to another jsp web page.
I don't think that this is suitable for JSF - it ignores or breaks too many of the JSF framework requirements.
However, there's a fairly simple alternative. Instead of routing your request via a JSF URL, write a small servlet whose doGet method invokes the JSF bean's method of interest and then forwards to the output JSP.
JSF beans aren't only accessible via JSF - it's perfectly valid to use them in any context as long as what you're doing isn't invoking JSF framework services, since there wouldn't be a JSF context when you invoke from a servlet or JSP.
You could simplify even more by making the target JSP invoke the JSF bean method, but that would violate the idea of Separation of Concerns. You'd get a simpler webapp but sacrifice some flexibility.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Dec 01, 2007
"You could simplify even more by making the target JSP invoke the JSF bean method, but that would violate the idea of Separation of Concerns. You'd get a simpler webapp but sacrifice some flexibility."
Can you provide me code for this solution?
Help will be greatly appreciated?
subject: How to call a jsf bean method from a html hyperlink?