JSF+Facelets+Seam需要加载的jar包及关键配置

by Lancer 23. October 2009 10:30

在\WebContent\WEB-INF\lib\下面应该有一下jar包

commons-beanutils.jar

commons-collections.jar

commons-digester.jar

commons-lang.jar

commons-logging.jar

jboss-el.jar

jboss-seam-debug.jar

jboss-seam-ui.jar

jboss-seam.jar

jsf-facelets.jar

richfaces-api.jar

richfaces-impl.jar

richfaces-ui.jar

 

持久层数据源 epmWeb-ds.xml 应放入部署目录,特别要注意的是jndi-name的配置,在persistence.xml要用到的:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE datasources
PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
"http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
<datasources>
<local-tx-datasource>
<jndi-name>epmWeb</jndi-name>
<connection-url>jdbc:sqlserver://192.168.0.10:1433;databaseName=××</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<user-name>××</user-name>
<password>×××××</password>
</local-tx-datasource>
</datasources>

 在src\META-INF\下面放入persistence.xml。要注意non-jta-data-source是数据源里面配置 的,jboss.entity.manager.factory.jndi.name是seam组件components.xml里面配置生成的。

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="epmJPA" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>java:/epmWeb</non-jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="jboss.entity.manager.factory.jndi.name"
value="java:/epmJPAEntityManagerFactory" />
</properties>
</persistence-unit>
</persistence>

在\WebContent\WEB-INF\下放入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:transaction="http://jboss.com/products/seam/transaction"
xmlns:security="http://jboss.com/products/seam/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">

<core:manager conversation-timeout="120000"
concurrent-request-timeout="500" conversation-id-parameter="cid" />

<transaction:entity-transaction
entity-manager="#{em}" />

<persistence:entity-manager-factory
name="epmJPA" installed="true" />

<!--
If Seam loads the persistence unit (JBoss 4.x), the
EntityManagerFactory will be resolved from #{bookingDatabase}. On
JBoss AS 5, the EntityManagerFactory is retrieved from JNDI (the
binding occurs during application deployment).
-->

<persistence:managed-persistence-context
name="em" auto-create="true" entity-manager-factory="#{epmJPA}"
persistence-unit-jndi-name="java:/epmJPAEntityManagerFactory" />

<security:identity authenticate-method="#{authenticator.authenticate}" />
</components>

 在\WebContent\WEB-INF\下放入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.1.xsd">
</pages>

 修改\WebContent\WEB-INF\web.xml:

<?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_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>epmWeb</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>/faces/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>

<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>

<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>

<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>

<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>

<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>

<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>

<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>

<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>

Tags: , ,

技术文章

Comments

8/3/2010 5:46:45 AM #

makeup artist classes houston

Making use of a base clean or even a sponge  mixture the cosmetic downward and outward    Make certain to merge the cosmetic down the jaw collection likewise to ensure there exists no obvious make-up collection  Tinted moisturizers are fantastic for dry or maturing epidermis mainly because they dont seep into lines and wrinkles and present lumination shee

makeup artist classes houston | Reply

Add comment


(Will show your Gravatar icon)

biuquote
  • Comment
  • Preview
Loading



Copyright © 2009 APJ Software

最新评论

Comment RSS

公告

欢迎使用APJ Blog!

日历

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar