John Eipe
John Eipe

Reputation: 11228

How does JSF tags affect JSP lifecycle methods? What about JSP and facelets?

Do JSP lifecycle methods run when using JSF tags in JSP pages? If so, what is the sequence?

Do JSP lifecycle methods run when using facelets?

Upvotes: 2

Views: 485

Answers (2)

Carlos Gavidia-Calderon
Carlos Gavidia-Calderon

Reputation: 7253

There's a very clarifying article on the subject in IBM's DeveloperWorks. On the subjetc of using JSP's in JSF applications it says the following:

The body of the JSP becomes the equivalent of a servlet's doGet() and doPost() methods (that is, it becomes the jspService() method). The JSF custom tags (such as f:view and h:form) are just calls to the JSF components to render themselves in their current state. The life cycle of the JSF component model is independent from the life cycle of the JSP-produced servlet.

So, the answer to your first question is yes; JSP pages follow their own lifecycle and JSF Components follow their own. On Facelets, you can also find this:

Unlike JSP, Facelets is a templating language built from the ground up with the JSF component life cycle in mind. With Facelets, you produce templates that build a component tree, not a servlet.

With that, there's no need of using JSP's with JSF if you're already using Facelets. So the answer to your second question would be no, as there are no JSP pages at all.

Upvotes: 4

Mike Braun
Mike Braun

Reputation: 3769

The JSP lifecycle methods (whatever those are) do not run when using JSF with Facelets, for the simple reason that Facelets is 100% separate from JSP.

You should btw never use JSF with JSP. It's a deprecated VDL for JSF, doesn't support the latest JSF features, and is just wrong.

Upvotes: 2

Related Questions