Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
The following page has been changed by WernerPunz:
http://wiki.apache.org/myfaces/jsf-spring
The comment on the change is:
moving the jsf-spring configuration files into their own page
------------------------------------------------------------------------------
jsf-spring integration web-xml for myfaces 1.0.9
spring stuff is read directly from applicationContext.xml
- {{{
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- * Copyright 2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
- <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <display-name>logoproto</display-name>
- <context-param>
- <description>
- Comma separated list of URIs of (additional) faces config
- files. (e.g. /WEB-INF/my-config.xml) See JSF 1.0 PRD2,
- 10.3.2
- </description>
- <param-name>javax.faces.CONFIG_FILES</param-name>
- <param-value>/WEB-INF/examples-config.xml</param-value>
- </context-param>
- <context-param>
- <description>
- State saving method: "client" or "server" (= default) See
- JSF Specification 2.5.2
- </description>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
- </context-param>
- <context-param>
- <description>
- This parameter tells MyFaces if javascript code should be
- allowed in the rendered HTML output. If javascript is
- allowed, command_link anchors will have javascript code that
- submits the corresponding form. If javascript is not
- allowed, the state saving info and nested parameters will be
- added as url parameters. Default: "true"
- </description>
- <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <description>
- This parameter tells MyFaces if javascript code should be
- allowed in the rendered HTML output. If javascript is
- allowed, command_link anchors will have javascript code that
- submits the corresponding form. If javascript is not
- allowed, the state saving info and nested parameters will be
- added as url parameters. Default: "false"
-
- Setting this param to true should be combined with
- STATE_SAVING_METHOD "server" for best results.
-
- This is an EXPERIMENTAL feature. You also have to enable the
- detector filter/filter mapping below to get JavaScript
- detection working.
- </description>
- <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
- <param-value>false</param-value>
- </context-param>
- <context-param>
- <description>
- If true, rendered HTML code will be formatted, so that it is
- "human readable". i.e. additional line separators and
- whitespace will be written, that do not influence the HTML
- code. Default: "true"
- </description>
- <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <description>
- If true, a javascript function will be rendered that is able
- to restore the former vertical scroll on every request.
- Convenient feature if you have pages with long lists and you
- do not want the browser page to always jump to the top if
- you trigger a link or button action that stays on the same
- page. Default: "false"
- </description>
- <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
- <param-value>true</param-value>
- </context-param>
- <filter>
- <filter-name>RequestHandled</filter-name>
- <filter-class>
- de.mindmatters.faces.spring.support.RequestHandledFilter
- </filter-class>
- </filter>
-
- <filter>
- <filter-name>extensionsFilter</filter-name>
- <filter-class>
- org.apache.myfaces.component.html.util.ExtensionsFilter
- </filter-class>
- <init-param>
- <description>
- Set the size limit for uploaded files. Format: 10 - 10
- bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
- </description>
- <param-name>uploadMaxFileSize</param-name>
- <param-value>100m</param-value>
- </init-param>
- <init-param>
- <description>
- Set the threshold size - files below this limit are
- stored in memory, files above this limit are stored on
- disk.
-
- Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
- </description>
- <param-name>uploadThresholdSize</param-name>
- <param-value>100k</param-value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>RequestHandled</filter-name>
- <url-pattern>/faces/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>RequestHandled</filter-name>
- <url-pattern>*.jsf</url-pattern>
- </filter-mapping>
-
-
-
- <filter-mapping>
- <filter-name>extensionsFilter</filter-name>
- <url-pattern>*.jsf</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>extensionsFilter</filter-name>
- <url-pattern>/faces/*</url-pattern>
- </filter-mapping>
- <!-- Listener, that does all the startup work (configuration, init). -->
- <listener>
- <listener-class>
- org.springframework.web.context.ContextLoaderListener
- </listener-class>
- </listener>
-
- <listener>
- <listener-class>
- org.apache.myfaces.webapp.StartupServletContextListener
- </listener-class>
- </listener>
-
- <listener>
- <listener-class>
- de.mindmatters.faces.spring.support.ContextLoaderListener
- </listener-class>
- </listener>
-
-
- <listener>
- <listener-class>
- org.apache.myfaces.webapp.StartupServletContextListener
- </listener-class>
- </listener>
- <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>*.jsf</url-pattern>
- </servlet-mapping>
- <welcome-file-list>
- <welcome-file>index.jsf</welcome-file>
- <welcome-file>index.jsp</welcome-file>
- <welcome-file>index.html</welcome-file>
- </welcome-file-list>
- </web-app>
-
- }}}
-
- Note if you use another spring config filename than applicationContext.xml you can add
- that according to the jsf-spring demo to the jsf config file list in the web.xml.
- This feature has not been tested by the author of this page by the time of writing.
-
-
- == JSF Spring Integration web-xml with working opensession in view Filter ==
-
-
- {{{
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- * Copyright 2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
- <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <display-name>logoproto</display-name>
- <context-param>
- <description>
- Comma separated list of URIs of (additional) faces config
- files. (e.g. /WEB-INF/my-config.xml) See JSF 1.0 PRD2,
- 10.3.2
- </description>
- <param-name>javax.faces.CONFIG_FILES</param-name>
- <param-value>/WEB-INF/examples-config.xml</param-value>
- </context-param>
- <context-param>
- <description>
- State saving method: "client" or "server" (= default) See
- JSF Specification 2.5.2
- </description>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
- </context-param>
- <context-param>
- <description>
- This parameter tells MyFaces if javascript code should be
- allowed in the rendered HTML output. If javascript is
- allowed, command_link anchors will have javascript code that
- submits the corresponding form. If javascript is not
- allowed, the state saving info and nested parameters will be
- added as url parameters. Default: "true"
- </description>
- <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <description>
- This parameter tells MyFaces if javascript code should be
- allowed in the rendered HTML output. If javascript is
- allowed, command_link anchors will have javascript code that
- submits the corresponding form. If javascript is not
- allowed, the state saving info and nested parameters will be
- added as url parameters. Default: "false"
-
- Setting this param to true should be combined with
- STATE_SAVING_METHOD "server" for best results.
-
- This is an EXPERIMENTAL feature. You also have to enable the
- detector filter/filter mapping below to get JavaScript
- detection working.
- </description>
- <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
- <param-value>false</param-value>
- </context-param>
- <context-param>
- <description>
- If true, rendered HTML code will be formatted, so that it is
- "human readable". i.e. additional line separators and
- whitespace will be written, that do not influence the HTML
- code. Default: "true"
- </description>
- <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <description>
- If true, a javascript function will be rendered that is able
- to restore the former vertical scroll on every request.
- Convenient feature if you have pages with long lists and you
- do not want the browser page to always jump to the top if
- you trigger a link or button action that stays on the same
- page. Default: "false"
- </description>
- <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
- <param-value>true</param-value>
- </context-param>
-
- <filter>
- <filter-name>RequestHandled</filter-name>
- <filter-class>
- de.mindmatters.faces.spring.support.RequestHandledFilter
- </filter-class>
- </filter>
-
- <filter>
- <filter-name>sessionFilter</filter-name>
- <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
- </filter>
-
- <filter>
- <filter-name>extensionsFilter</filter-name>
- <filter-class>
- org.apache.myfaces.component.html.util.ExtensionsFilter
- </filter-class>
- <init-param>
- <description>
- Set the size limit for uploaded files. Format: 10 - 10
- bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
- </description>
- <param-name>uploadMaxFileSize</param-name>
- <param-value>100m</param-value>
- </init-param>
- <init-param>
- <description>
- Set the threshold size - files below this limit are
- stored in memory, files above this limit are stored on
- disk.
-
- Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
- </description>
- <param-name>uploadThresholdSize</param-name>
- <param-value>100k</param-value>
- </init-param>
- </filter>
-
-
-
- <filter-mapping>
- <filter-name>RequestHandled</filter-name>
- <url-pattern>/faces/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>RequestHandled</filter-name>
- <url-pattern>*.jsf</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>sessionFilter</filter-name>
- <url-pattern>*.jsf</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>sessionFilter</filter-name>
- <url-pattern>/faces/*</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>extensionsFilter</filter-name>
- <url-pattern>*.jsf</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>extensionsFilter</filter-name>
- <url-pattern>/faces/*</url-pattern>
- </filter-mapping>
- <!-- Listener, that does all the startup work (configuration, init). -->
- <listener>
- <listener-class>
- org.springframework.web.context.ContextLoaderListener
- </listener-class>
- </listener>
-
- <listener>
- <listener-class>
- org.apache.myfaces.webapp.StartupServletContextListener
- </listener-class>
- </listener>
-
- <listener>
- <listener-class>
- de.mindmatters.faces.spring.support.ContextLoaderListener
- </listener-class>
- </listener>
-
-
- <listener>
- <listener-class>
- org.apache.myfaces.webapp.StartupServletContextListener
- </listener-class>
- </listener>
- <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>*.jsf</url-pattern>
- </servlet-mapping>
- <welcome-file-list>
- <welcome-file>index.jsf</welcome-file>
- <welcome-file>index.jsp</welcome-file>
- <welcome-file>index.html</welcome-file>
- </welcome-file-list>
- </web-app>
- }}}
-
- additionally a working template applicationContext.xml
-
- {{{
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
- <!--
- Manual application context
- all the manually defined stuff goes in here
- you can edit this file to your needs
-
- -->
-
- <beans>
- <bean id="programDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
- <property name="driverClassName">
- <value>driverclass</value>
- </property>
- <property name="url">
- <value>xx:driver</value>
- </property>
- <property name="username">
- <value>username</value>
- </property>
- <property name="password">
- <value>password</value>
- </property>
- </bean>
- <bean id="sessionFactory"
- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="mappingResources">
- <list>
- <value>path.to.hbm.xml</value>
- </list>
- </property>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">
- serverdialect accpording to the hibernate settings
- </prop>
- <prop key="hibernate.show_sql">false</prop>
- <prop key="hibernate.use_outer_join">true</prop>
- <prop key="hibernate.max_fetch_depth">3</prop>
- <prop key="hibernate.cache.use_query_cache">true</prop>
- </props>
- </property>
- <property name="dataSource">
- <ref bean="programDataSource" />
- </property>
- </bean>
-
- <bean id="txManager"
- class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <property name="sessionFactory">
- <ref local="sessionFactory"/>
- </property>
- </bean>
-
- <bean id="theDAO" class="class.definition.for.DAO">
- <property name="sessionFactory">
- <ref local="sessionFactory"/>
- </property>
- </bean>
-
- <bean id="theBOTarget" class="class.definition.for.BO">
- </bean>
-
- <bean id="theBO" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
- <property name="target" ref="theBOTarget"/>
- <property name="transactionManager" ref="txManager" />
- <property name="transactionAttributes">
- <props>
- <prop key="transactional_*">PROPAGATION_REQUIRED</prop>
- </props>
- </property>
- </bean>
- </beans>
- }}}
-
== Usefule Links ==
-
+ *["JSF Spring Config"] Configuration file templates for JSF Spring
*[http://jacn.sourceforge.net/ jsf-spring integrator]without springs xml usage
*[http://jsf-spring.sourceforge.net/ jsf-spring] integration library by mindmatters
*[http://www.springproject.org spring] library
|