Jboss Seam interview questions
Seam Interview Questions
Q: What is Jboss Seam?
Seam is an Enterprise Java application framework.
Q: Why Seam?
Q: Does Seam support internationalization?
Seam includes multiple JSF extensions, which make internationalized user interfaces super-easy and super-elegant.
Q: What does it mean by conversation model
Q: How to configure Seam Listener?
To manage Seam context, add Seam servlet listener in your web.xml.
Q: How to configure JSF Phase Listener?
Seam Phase Listener handles the Seam contexts associated with a JSF request throughout the application's lifecycle. Add below entry in faces-config.xml.
Q: How to configure EJB Seam Interceptor?
Declare EJB SeamInterceptor in ejb-jar.xml file.
Q: Where to define Seam's core initialization component?
For Seam to use the EJB container, a Seam core initialization module entry must be included in Seam's components.xml.
Q: How can I access Session or Seam Request?
Q: How to use conversation in application?
If you wantur to propagate a Seam conversation across a non-faces request, you need to explicitly code the Seam conversation id as a request parameter: Or, the more JSF-ish: If you use the Seam tag library, this is equivalent:
If you wish to disable propagation of the conversation context for a postback, a similar trick is used: If you use the Seam tag library, this is equivalent: Note that disabling conversation context propagation is absolutely not
the same thing as ending the conversation. The conversationPropagation request parameter, or the <s:conversationPropagation> tag may even be used to begin and end conversation, or begin a nested conversation.
Q: What is workspace management?
The user is able to switch between many conversations within the same browser window. This feature is called workspace management.
Q: What is nested conversation?
A nested conversation is created by invoking a method marked @Begin(nested=true) inside the scope of an existing conversation. A nested conversation has its own conversation context,
but can read values from the outer conversation's context.
Q: What is Jboss Seam?
Ans:
Seam is an Enterprise Java application framework.
- Seam works in your application server that supports EJB 3.0.
- Seam framework can be used in you application using JSF, Hibernate/JPA/JDBC etc, JavaBeans (Business Logic)
- Seam can be stateful, with state associated with the conversation context, long-running context, business process context, persistent , which maintain state across multiple web requests in a user conversations.
Q: Why Seam?
Ans:
- Keeping AJAX in mind, Seam's completely unique concurrency model and state-management system were developed and designed.
- Seam integrates jBPM deeply and makes using jBPM for task management or pageflow incredibly easy, and is a perfect way to get started with BPM technology
- This is the best way to develop application using JSF.
- Seam has been developed for use with EJB 3.0 and can be used everywhere with the latest module framework.
- Seam's conversation model resolves a number of programming problems related to persistence caused by conventional stateless architecture for web applications. Seam allows using extended persistence contexts in a simple way, and lets you avoid unnecessary replication of the state when using an extended context of persistence in a clustered environment.
- When it is a matter of creating easy data-driven applications, seam is as efficient as every other crop of CRUD frames.
- Seam presents a new automated integration testing approach, which allows you to simulate the entire request or conversation process.
- The Seam project is completely committed to the idea of open source new ideas and developments in the Java platform.
- Seam is the first programming model which can be used from the persistence layer up to the UI using Java 5 annotations end to end.
Q: Does Seam support internationalization?
Ans:
Seam includes multiple JSF extensions, which make internationalized user interfaces super-easy and super-elegant.
Q: What does it mean by conversation model
Ans:
- During the application request values, process validations, updating model values, invoking application and rendering response phases of the JSF request lifecycle, a conversation context is always active.
- Seam attempts to restore a long-running conversation context after the restoration process of the JSF request life cycle. If there is none, Seam will create a new temporary context for conversation.
- The temporary conversation context is transferred to a long-running conversation when a @Begin method is encountered.
- Any long-running conversation context is demoted into a temporary conversation when a @End method is encountered.
- Seam stores the contents of a long-running conversation context or removes the contents of a temporary conversation context at the end of the JSF request lifecycle's render response phase.
- Any request for faces (JSF postback) will distribute the conversation context.By default, requests for non-faces (e.g. GET requests) do not distribute conversation context.
- If a redirect foreshort the lifecycle of the JSF query, Seam can transparently store and restore the current conversation context unless the conversation has already been completed via@End(beforeRedirect = true).
Q: How to configure Seam Listener?
Ans:
To manage Seam context, add Seam servlet listener in your web.xml.
<faces-config>
. . .
<lifecycle>
<phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
</lifecycle>
. . .
</faces-config>
Q: How to configure JSF Phase Listener?
Ans:
Seam Phase Listener handles the Seam contexts associated with a JSF request throughout the application's lifecycle. Add below entry in faces-config.xml.
<web-app>
. . .
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
. . .
</web-app>
Q: How to configure EJB Seam Interceptor?
Ans:
Declare EJB SeamInterceptor in ejb-jar.xml file.
<ejb-jar>
. . .
<assembly-descriptor>
<interceptors>
<interceptor>
<interceptor-class>
org.jboss.seam.ejb.SeamInterceptor
</interceptor-class>
</interceptor>
</interceptors>
<interceptor-binding>
<ejb-name>*</ejb-name>
<interceptor-class>
org.jboss.seam.ejb.SeamInterceptor
</interceptor-class>
</interceptor-binding>
</assembly-descriptor>
. . .
</ejb-jar>
Q: Where to define Seam's core initialization component?
Ans:
For Seam to use the EJB container, a Seam core initialization module entry must be included in Seam's components.xml.
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
<core:init jndi-pattern="@jndiPattern@"/>
</components>
Q: How can I access Session or Seam Request?
Ans:
- Using ServletContexts.instance().getRequest() in your backing bean.
- Inject the HttpServletRequest or HttpSession directly from your Seam component by declaring factory component descriptor.
<factory name="httpRequest"
value="{facesContext.externalContext.request}"
auto-create="true"/>
<factory name="httpSession"
value="{facesContext.externalContext.request.session}"
auto-create="true"/>