Conversation scope for my JSF proyect
kk1706 Oct 20, 2010 4:08 PMHi
I want to implement "conversation scope" in my jsf project without using EJB. I just wish to put my "backing beans" in a "conversation scope" and continue using the faces-config file for the managed-beans and navigations rules. I tried to set "conversation" from the online manual and some tutorials and examples on the Internet. but until now I could not turn on the "conversation scope" and I see no errors in the console application.
I'll show you the settings I'm using my little test project
Let me know if I'm missing something or doing something wrong.
Facelets 1.1.14
RichFaces 3.3.0GA
jboss-seam-2.2.1.CR2
jboss-seam.jar
jboss-seam-ui.jar
jboss-el.jar
antlr.jar
dom4j.jar
hibernate-validation.jar
javassist.jar
persistence-api.jar
jta.jar
Web.xml config
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
faces-config.xml
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
<managed-bean>
<managed-bean-name>templatetable</managed-bean-name>
<managed-bean-class>conversation.Templatetable</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>templateback</managed-bean-name>
<managed-bean-class>conversation.Templateback</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<description>PAGINA INICIAL</description>
<from-view-id>/test/Templatetable.xhtml</from-view-id>
<navigation-case>
<from-outcome>next</from-outcome>
<to-view-id>/test/Templateback.xhtml</to-view-id>
<redirect />
</navigation-case>
<navigation-case>
<from-outcome>exit</from-outcome>
<to-view-id>/Templateclient</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
<navigation-rule>
<description>SEGUNDA PAGINA</description>
<from-view-id>/test/Templateback.xhtml</from-view-id>
<navigation-case>
<from-outcome>back</from-outcome>
<to-view-id>/test/Templatetable.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
pages.xml
<?xml version="1.0" encoding="UTF-8"?>
<pages xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd" >
<page view-id="/test/*">
<begin-conversation join="true"/>
</page>
</pages>
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:persistence="http://jboss.com/products/seam/persistence"
xmlns:drools="http://jboss.com/products/seam/drools"
xmlns:bpm="http://jboss.com/products/seam/bpm"
xmlns:security="http://jboss.com/products/seam/security"
xmlns:mail="http://jboss.com/products/seam/mail"
xmlns:web="http://jboss.com/products/seam/web"
xmlns:transaction="http://jboss.com/products/seam/transaction"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd
http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.2.xsd
http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd
http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd
http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.2.xsd
http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.2.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd">
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000"
conversation-id-parameter="cid"
parent-conversation-id-parameter="pid"/>
<component name="org.jboss.seam.core.init">
<property name="debug">true</property>
</component>
<!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
<!-- web:hot-deploy-filter url-pattern="*.jsf"/-->
<web:cache-control-filter name="imageCacheControlFilter"
regex-url-pattern=".*(\.gif|\.png|\.jpg|\.jpeg)"
value="max-age=86400"/>
<web:cache-control-filter name="textCacheControlFilter"
regex-url-pattern=".*(\.css|\.js)"
value="max-age=1400"/>
<web:ajax4jsf-filter force-parser="false"
enable-cache="true"
url-pattern="*.jsf"/>
Welcome page (forward.jsp)
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:forward page="/test/Templatetable.jsf"/>
Pagaes are in webapp/test folder
Templatetable.java
package conversation;
import java.io.Serializable;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Scope;
@Scope(ScopeType.CONVERSATION)
public class Templatetable implements Serializable {
private String campo;
public String getCampo() {
return campo;
}
public void setCampo(String campo) {
this.campo = campo;
}
public String doNext() {
return "next";
}
public String doExit() {
return "exit";
}
}
Templateback.java
package conversation;
import java.io.Serializable;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.Scope;
@Scope(ScopeType.CONVERSATION)
public class Templateback implements Serializable {
public Templateback() {
}
@End( beforeRedirect=true )
public String doBack() {
return "back";
}
}
I want to implement "conversation scope" in my jsf project without using EJB. I just wish to put my "backing beans" in a "conversation scope" and continue using the faces-config file for the managed-beans and navigations rules. I tried to set "conversation" from the online manual and some tutorials and examples on the Internet. but until now I could not turn on the "conversation scope" and I see no errors in the console application.
I'll show you the settings I'm using my little test project
Let me know if I'm missing something or doing something wrong.
Facelets 1.1.14
RichFaces 3.3.0GA
jboss-seam-2.2.1.CR2
jboss-seam.jar
jboss-seam-ui.jar
jboss-el.jar
antlr.jar
dom4j.jar
hibernate-validation.jar
javassist.jar
persistence-api.jar
jta.jar
Web.xml config
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
faces-config.xml
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
<managed-bean>
<managed-bean-name>templatetable</managed-bean-name>
<managed-bean-class>conversation.Templatetable</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>templateback</managed-bean-name>
<managed-bean-class>conversation.Templateback</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<description>PAGINA INICIAL</description>
<from-view-id>/test/Templatetable.xhtml</from-view-id>
<navigation-case>
<from-outcome>next</from-outcome>
<to-view-id>/test/Templateback.xhtml</to-view-id>
<redirect />
</navigation-case>
<navigation-case>
<from-outcome>exit</from-outcome>
<to-view-id>/Templateclient</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
<navigation-rule>
<description>SEGUNDA PAGINA</description>
<from-view-id>/test/Templateback.xhtml</from-view-id>
<navigation-case>
<from-outcome>back</from-outcome>
<to-view-id>/test/Templatetable.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
pages.xml
<?xml version="1.0" encoding="UTF-8"?>
<pages xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd" >
<page view-id="/test/*">
<begin-conversation join="true"/>
</page>
</pages>
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:persistence="http://jboss.com/products/seam/persistence"
xmlns:drools="http://jboss.com/products/seam/drools"
xmlns:bpm="http://jboss.com/products/seam/bpm"
xmlns:security="http://jboss.com/products/seam/security"
xmlns:mail="http://jboss.com/products/seam/mail"
xmlns:web="http://jboss.com/products/seam/web"
xmlns:transaction="http://jboss.com/products/seam/transaction"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd
http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.2.xsd
http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd
http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd
http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.2.xsd
http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.2.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd">
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000"
conversation-id-parameter="cid"
parent-conversation-id-parameter="pid"/>
<component name="org.jboss.seam.core.init">
<property name="debug">true</property>
</component>
<!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
<!-- web:hot-deploy-filter url-pattern="*.jsf"/-->
<web:cache-control-filter name="imageCacheControlFilter"
regex-url-pattern=".*(\.gif|\.png|\.jpg|\.jpeg)"
value="max-age=86400"/>
<web:cache-control-filter name="textCacheControlFilter"
regex-url-pattern=".*(\.css|\.js)"
value="max-age=1400"/>
<web:ajax4jsf-filter force-parser="false"
enable-cache="true"
url-pattern="*.jsf"/>
Welcome page (forward.jsp)
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:forward page="/test/Templatetable.jsf"/>
Pagaes are in webapp/test folder
Templatetable.java
package conversation;
import java.io.Serializable;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Scope;
@Scope(ScopeType.CONVERSATION)
public class Templatetable implements Serializable {
private String campo;
public String getCampo() {
return campo;
}
public void setCampo(String campo) {
this.campo = campo;
}
public String doNext() {
return "next";
}
public String doExit() {
return "exit";
}
}
Templateback.java
package conversation;
import java.io.Serializable;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.Scope;
@Scope(ScopeType.CONVERSATION)
public class Templateback implements Serializable {
public Templateback() {
}
@End( beforeRedirect=true )
public String doBack() {
return "back";
}
}