0
다음 envirnoment를 사용하여 간단한 응용 프로그램을 개발하고 싶습니다.Spring 3.0 annotated bean form 삽입하기 JBoss Seam 2.3 Action Bean
- 보스 7.1.1
- 제이보스 심 2.3
- JSF 2.0
- Rifaces 4.0
- 봄 3.0
- JPA 2.0
- 이클립스 IDE 보스 도구 3.2
대부분의 구성이 제대로 작동하지 않습니다. 케이. 하지만 Seam Action Bean에서 Spring Bean을 삽입 할 수는 없습니다. 페이지가로드 될 때 오류 및 예외는 없습니다. 내 데이터 테이블은
에서<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>jsf-seam</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>blueSky</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>
<servlet>
<servlet-name>Seam Resource Servlet</servlet-name>
<servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Seam Resource Servlet</servlet-name>
<url-pattern>/seam/resource/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<security-constraint>
<display-name>Restrict raw XHTML Documents</display-name>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
</web-app>
얼굴-config.xml에 component.xml에서
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
</faces-config>
, web.xml에
이다;<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.org/schema/seam/components"
xmlns:core="http://jboss.org/schema/seam/core"
xmlns:persistence="http://jboss.org/schema/seam/persistence"
xmlns:drools="http://jboss.org/schema/seam/drools"
xmlns:bpm="http://jboss.org/schema/seam/bpm"
xmlns:security="http://jboss.org/schema/seam/security"
xmlns:mail="http://jboss.org/schema/seam/mail"
xmlns:web="http://jboss.org/schema/seam/web"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://jboss.com/products/seam/spring"
xsi:schemaLocation=
"http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd
http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd
http://jboss.org/schema/seam/drools http://jboss.org/schema/seam/drools-2.3.xsd
http://jboss.org/schema/seam/bpm http://jboss.org/schema/seam/bpm-2.3.xsd
http://jboss.org/schema/seam/security http://jboss.org/schema/seam/security-2.3.xsd
http://jboss.org/schema/seam/mail http://jboss.org/schema/seam/mail-2.3.xsd
http://jboss.org/schema/seam/web http://jboss.org/schema/seam/web-2.3.xsd
http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
<core:init debug="true" jndi-pattern="@[email protected]"/>
<spring:context-loader config-locations="classpath:spring-bean.xml"/>
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000"
conversation-id-parameter="cid"
parent-conversation-id-parameter="pid"/>
<!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
<web:hot-deploy-filter url-pattern="*.seam"/>
<!-- If you are still using JBoss 4, uncomment this to have your PU started -->
<!-- <persistence:entity-manager-factory name="entityManagerFactory"-->
<!-- persistence-unit-name="jsf-seam"/>-->
<!-- If you are still using JBoss 4, uncomment this to have the entityManagerFactory ysed -->
<!-- <persistence:managed-persistence-context name="entityManager" auto-create="true"-->
<!-- entity-manager-factory="#{entityManagerFactory}"/>-->
<persistence:managed-persistence-context name="entityManager" auto-create="true"
persistence-unit-jndi-name="java:/jsf-seamEntityManagerFactory"/>
<drools:rule-base name="securityRules">
<drools:rule-files><value>/security.drl</value></drools:rule-files>
</drools:rule-base>
<security:rule-based-permission-resolver security-rules="#{securityRules}"/>
<security:identity authenticate-method="#{authenticator.authenticate}" remember-me="true"/>
<event type="org.jboss.seam.security.notLoggedIn">
<action execute="#{redirect.captureCurrentView}"/>
</event>
<event type="org.jboss.seam.security.loginSuccessful">
<action execute="#{redirect.returnToCapturedView}"/>
</event>
<mail:mail-session host="localhost" port="25"/>
<!-- For use with jBPM pageflow or process management -->
<!--
<bpm:jbpm>
<bpm:process-definitions></bpm:process-definitions>
<bpm:pageflow-definitions></bpm:pageflow-definitions>
</bpm:jbpm>
-->
</components>
내 Seam Action Bean;
@Scope(CONVERSATION)
@Name("ManageDepartmentBean")
public class ManageDepartmentBean implements Serializable {
private static final long serialVersionUID = -4373053763864526454L;
@Out(value = "departmentList")
public List<Department> departmentList;
public List<Department> getDepartmentList() {
return departmentList;
}
@In("#{DepartmentService}")
private IDepartmentService departmentService;
@Begin
public String begin() {
departmentList = departmentService.findAllDepartments();
return "success";
}
public String increment() {
return "success";
}
@End
public String end() {
return "home";
}
}
내 봄 콩에서;
@Service(value = "DepartmentService")
public class DepartmentService implements IDepartmentService{
@Resource(name = "DepartmentDAO")
private IDepartmentDAO departmentDAO;
@Transactional(propagation = Propagation.REQUIRED)
public List<Department> findAllDepartments() {
return departmentDAO.findAll();
}
}
또한 아래의 web.xml에서 사용하려고 시도하지만 작동하지 않습니다.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
내 페이지에 있습니다.
<rich:dataTable value="#{ManageDepartmentBean.departmentList}" var="dep" id="departmentTable">
<rich:column sortBy="#{dep.id}">
<f:facet name="header">
<h:outputText value="Department ID"/>
</f:facet>
<h:outputText value="#{dep.id}" />
</rich:column>
<rich:column sortBy="#{dep.name}">
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:outputText value="#{dep.name}" />
</rich:column>
<rich:column sortBy="#{dep.description}">
<f:facet name="header">
<h:outputText value="Description"/>
</f:facet>
<h:outputText value="#{dep.description}}" />
</rich:column>
</rich:dataTable>