SWF-1411 SWF-1409 Documentation fixes

This commit is contained in:
Rossen Stoyanchev
2010-10-28 13:44:57 +00:00
parent d2e45a8582
commit 21d314b9b8
3 changed files with 90 additions and 6 deletions

View File

@@ -7,7 +7,7 @@
<title>Introduction</title>
<para>
This chapter shows how to use Web Flow in a Portlet environment.
Web Flow has full support for JSR-168 portlets.
Spring Web Flow requires Portlet API 2.0 to run with.
The <code>booking-portlet-mvc</code> sample application is a good reference for using Web Flow within a portlet.
This application is a simplified travel site that allows users to search for and book hotel rooms.
</para>
@@ -16,7 +16,7 @@
<title>Configuring web.xml and portlet.xml</title>
<para>
The configuration for a portlet depends on the portlet container used.
The sample applications, included with Web Flow, are both configured to use <ulink url="http://portals.apache.org/pluto/">Apache Pluto</ulink>, the JSR-168 reference implementation.
The sample applications, included with Web Flow, are both configured to use <ulink url="http://portals.apache.org/pluto/">Apache Pluto</ulink>.
</para>
<para>
In general, the configuration requires adding a servlet mapping in the <code>web.xml</code> file to dispatch request to the portlet container.

View File

@@ -11,7 +11,7 @@
2.2 the JSF integration is supported with JSF 1.2 and JSF 2.0 including Sun Mojarra and Apache
MyFaces. Please, note however that JSF 2 partial state saving is not yet supported with
Apache MyFaces and needs to be disabled with the <code>javax.faces.PARTIAL_STATE_SAVING</code>
context parameter in <code>web.xml</code>
context parameter in <code>web.xml</code>.
</para>
<para>
Spring Web Flow provides a Spring Security tag library for JSF 2 and JSF 1.2 environments.
@@ -25,6 +25,12 @@
and RichFaces. The <code>swf-booking-faces</code> sample in the Spring Web Flow distribution
is built on JSF 2 and PrimeFaces components.
</para>
<para>
Spring Web Flow also supports using JSF in a portlet environment.
Spring Web Flow's portlet integration supports Portlets API 2.0 and JSF 1.2 only.
Currently JSF 2 is not supported in combination with portlets.
See <xref linkend="portlet"/> for more on Spring Web Flow's portlet integration.
</para>
</sect1>
<sect1 id="spring-faces-integration">
<title>JSF Integration For Spring Developers</title>
@@ -100,10 +106,14 @@
</servlet-mapping>]]>
</programlisting>
<para>
When using the Spring Faces components (JSF 1.2 only), you also need to configure a servlet for serving
When using the JSF 1.2 Spring Faces components, you also need to configure a servlet for serving
CSS and JavaScript resources. This servlet must be mapped
to /resources/* in order for the URL's rendered by the components to function correctly.
</para>
<para>
Note that while the <code>ResourceServlet</code> is deprected in favor of the Spring 3 <code>resources</code>
element, it is still required for use with JSF 1.2 Spring Faces components.
</para>
<programlisting language="xml"><![CDATA[
<!-- Serves static resource content from .jar files such as spring-faces.jar -->
<servlet>

View File

@@ -17,7 +17,8 @@
<sect1 id="spring-js-resource-servlet">
<title>Serving Javascript Resources</title>
<para>
Spring JS provides a generic <code>ResourceServlet</code> to serve web resources such as JavaScript and CSS files from jar files, as well as the webapp root directory.
Spring JS provides a generic <code>ResourceServlet</code> to serve web resources such as JavaScript and CSS files from jar files,
as well as the webapp root directory.
This servlet provides a convenient way to serve Spring.js files to your pages.
To deploy this servlet, declare the following in <code>web.xml</code>:
</para>
@@ -34,7 +35,80 @@
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>]]>
</programlisting>
</sect1>
<para>
Note that starting with version 3.0.4, the Spring Framework includes
a replacement for the <code>ResourceServlet</code> (see the
<ulink url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-static-resources">Spring Framework documentation</ulink>).
With the new &lt;mvc:resources&gt; element resource requests (.js, .css) are handled by the
<code>DispatcherSevlet</code> without the need for a separate <code>ResourceServlet</code>.
Here is the relevant portion of the Spring MVC configuration in
the mvc-booking sample:
</para>
<programlisting language="xml"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<mvc:annotation-driven/>
<mvc:resources mapping="/resources/**" location="/, classpath:/META-INF/web-resources/" />
...
</beans>
]]>
</programlisting>
<para>
This incoming maps requests for <code>/resources</code> to resources found under
<code>/META-INF/web-resources</code> on the classpath. That's where Spring JavaScript resources
are bundled. However, you can modify the location attribute in the above configuration in order
to serve resources from any classpath or web application relative location.
</para>
<para>
Note that the full resource URL depends on how your DispatcherServlet is mapped.
In the mvc-booking sample we've chosen to map it with the default servlet mapping '/':
</para>
<programlisting language="xml"><![CDATA[
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
]]>
</programlisting>
<para>
That means the full URL to load <code>Spring.js</code> is <code>/myapp/resources/spring/Spring.js</code>.
If your <code>DispatcherServlet</code> was instead mapped to <code>/main/*</code> then the full
URL would be <code>/myapp/main/resources/spring/Spring.js</code>.
</para>
<para>
When using of the default servlet mapping it is also recommended to add this to your Spring MVC
configuration, which ensures that any resource requests not handled by your Spring MVC mappings
will be delegated back to the Servlet container.
</para>
<programlisting language="xml"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
...
<mvc:default-servlet-handler />
</beans>
]]>
</programlisting>
</sect1>
<sect1 id="spring-js-includes">
<title>Including Spring Javascript in a Page</title>
<para>