Most frameworks integrate directly by having you call their framework-specific servlets to
integrate with the architecture. Seam is different; it controls items by adding listeners and
life cycles into the request. This allows us to maintain the normal life cycle of a JSF
request. You saw this already earlier in the chapter when I presented Seam’s basic configuration.
Here I will explain it in a bit more detail.
Before I start explaining how Seam integrates with the various areas, you need to be
aware of a central class: org.jboss.seam.context.Lifecyle. This is the class that will keep
our contexts straight. Contexts will handle state in the web tier in a more advanced way
than a standard request and session object.
As you may recall, in the web.xml a listener (org.jboss.seam.servlet.SeamListener) was
added. You also see this listener being the first thing called in our sequence diagram. This
listener is called only at the start of a new session. This will set ServletContext and Session
to the Lifecycle object for manipulation later.
Now you see the next object called is SeamPhaseListener. The SeamPhaseListener object
is called in connection with FacesServlet. As you saw in faces-config.xml earlier, the
SeamPhaseListener is part of the life cycle for FacesServlet. This again is used to control
much of the context and to store the request state. This listener is needed to help move
the data from the presentation to the business logic tier. In a typical JSF life cycle, you
would use backing beans. Now instead of having to worry about your backing beans
needing to translate the data and call EJBs, Seam will handle this directly for us.
Copied from: Beginnign JBoss Seam by Joseph Faisal Nusairat
integrate with the architecture. Seam is different; it controls items by adding listeners and
life cycles into the request. This allows us to maintain the normal life cycle of a JSF
request. You saw this already earlier in the chapter when I presented Seam’s basic configuration.
Here I will explain it in a bit more detail.
Before I start explaining how Seam integrates with the various areas, you need to be
aware of a central class: org.jboss.seam.context.Lifecyle. This is the class that will keep
our contexts straight. Contexts will handle state in the web tier in a more advanced way
than a standard request and session object.
As you may recall, in the web.xml a listener (org.jboss.seam.servlet.SeamListener) was
added. You also see this listener being the first thing called in our sequence diagram. This
listener is called only at the start of a new session. This will set ServletContext and Session
to the Lifecycle object for manipulation later.
Now you see the next object called is SeamPhaseListener. The SeamPhaseListener object
is called in connection with FacesServlet. As you saw in faces-config.xml earlier, the
SeamPhaseListener is part of the life cycle for FacesServlet. This again is used to control
much of the context and to store the request state. This listener is needed to help move
the data from the presentation to the business logic tier. In a typical JSF life cycle, you
would use backing beans. Now instead of having to worry about your backing beans
needing to translate the data and call EJBs, Seam will handle this directly for us.
Copied from: Beginnign JBoss Seam by Joseph Faisal Nusairat
No comments:
Post a Comment