This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
An IDE is no substitute for an Intelligent Developer.
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."