You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2005/11/26 12:58:58 UTC

svn commit: r349108 - in /struts/apps/trunk/cookbook/src/webapp: WEB-INF/struts-config.xml WEB-INF/web.xml index.jsp jsp/Wildcard/ jsp/Wildcard/MatchAny.jsp jsp/Wildcard/MatchOne.jsp jsp/Wildcard/Source.jsp jsp/Wildcard/Wildcard.jsp

Author: husted
Date: Sat Nov 26 03:58:52 2005
New Revision: 349108

URL: http://svn.apache.org/viewcvs?rev=349108&view=rev
Log:
Cookbook - Add page demonstrating Wildcard mappings.
* Note that consistent use of initial case for component names makes names easier to use in Wildcard expressions.
* The Cookbook is another place where Wildcard mappings could normalize and condense the struts-config.xml

Added:
    struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/
    struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchAny.jsp
    struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchOne.jsp
    struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Source.jsp
    struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Wildcard.jsp
Modified:
    struts/apps/trunk/cookbook/src/webapp/WEB-INF/struts-config.xml
    struts/apps/trunk/cookbook/src/webapp/WEB-INF/web.xml
    struts/apps/trunk/cookbook/src/webapp/index.jsp

Modified: struts/apps/trunk/cookbook/src/webapp/WEB-INF/struts-config.xml
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/webapp/WEB-INF/struts-config.xml?rev=349108&r1=349107&r2=349108&view=diff
==============================================================================
--- struts/apps/trunk/cookbook/src/webapp/WEB-INF/struts-config.xml (original)
+++ struts/apps/trunk/cookbook/src/webapp/WEB-INF/struts-config.xml Sat Nov 26 03:58:52 2005
@@ -85,13 +85,17 @@
 	<!-- ========== Global Forward Definitions ============================= -->
 
 	<global-forwards>
-		<forward name="home" path="/index.jsp" redirect="true"/>
+		<forward name="home" path="/home.do"/>
 	</global-forwards>
 
 	<!-- ========== Action Mapping Definitions ============================= -->
 	<action-mappings>
 
-		<!-- Simple ActionForm Example ===================================== -->
+    <action path="/Home" type="examples.SuccessAction">
+        <forward name="success" path="/index.jsp" redirect="true"/>
+    </action>
+
+        <!-- Simple ActionForm Example ===================================== -->
 
 		<action path="/prepareSimple" 
 				type="examples.SuccessAction">

Modified: struts/apps/trunk/cookbook/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/webapp/WEB-INF/web.xml?rev=349108&r1=349107&r2=349108&view=diff
==============================================================================
--- struts/apps/trunk/cookbook/src/webapp/WEB-INF/web.xml (original)
+++ struts/apps/trunk/cookbook/src/webapp/WEB-INF/web.xml Sat Nov 26 03:58:52 2005
@@ -12,7 +12,10 @@
     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
     <init-param>
       <param-name>config</param-name>
-      <param-value>/WEB-INF/struts-config.xml</param-value>
+      <param-value>
+          /WEB-INF/struts-config.xml,
+          /WEB-INF/struts-config-Wildcard.xml
+       </param-value>
     </init-param>
     <load-on-startup>2</load-on-startup>
   </servlet>

Modified: struts/apps/trunk/cookbook/src/webapp/index.jsp
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/webapp/index.jsp?rev=349108&r1=349107&r2=349108&view=diff
==============================================================================
--- struts/apps/trunk/cookbook/src/webapp/index.jsp (original)
+++ struts/apps/trunk/cookbook/src/webapp/index.jsp Sat Nov 26 03:58:52 2005
@@ -183,6 +183,20 @@
 		<html:link page="/jsp/token/source.jsp">View source</html:link>
 	</td>
   </tr>
+  <tr valign="top">
+    <td>Wildcard Action Mappings</td>
+    <td><html:link action="/PrepareWildcard">
+		  <img src="images/execute.gif" alt="" hspace="4" border="0"  align="top" class="inline" />
+		</html:link>
+		<html:link action="/PrepareWildcard">Execute</html:link>
+	</td>
+    <td><html:link action="/SourceWildcard">
+		  <img src="images/code.gif" alt="" width="24" height="24" hspace="4" border="0" align="top" class="inline" />
+		</html:link>
+		<html:link action="/SourceWildcard">View source</html:link>
+	</td>
+  </tr>
+
 </table>
 <p><img src="images/valid-xhtml10.png" alt="Valid XHTML 1.0!" height="31" width="88" /></p>
 </body>

Added: struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchAny.jsp
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchAny.jsp?rev=349108&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchAny.jsp (added)
+++ struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchAny.jsp Sat Nov 26 03:58:52 2005
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%@ page language="java" contentType="text/html; charset=utf-8" %>
+<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
+
+<html:html xhtml="true" lang="true">
+<head>
+    <link rel="stylesheet" type="text/css" href="css/example.css" />
+    <title>Wildcard Mapping Example Demonstrating Match Any</title>
+</head>
+<body>
+<html:link action="SourceWildcard">
+    <img src="images/code.gif" width="24" height="24" alt="View Source" class="icon" />
+</html:link>
+<html:link action="Home">
+    <img src="images/return.gif" height="24" width="24" alt="Return to examples page" class="icon" />
+</html:link>
+<h1>Wildcard Mapping Example Results - Match Any</h1>
+<hr noshade="noshade"/>
+<p>
+    This page displays when any "WildCard" link is selected,
+    except the "WildCard-Not" link.
+</p>
+<h2>Press back</h2>
+</body>
+</html:html>
\ No newline at end of file

Added: struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchOne.jsp
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchOne.jsp?rev=349108&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchOne.jsp (added)
+++ struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/MatchOne.jsp Sat Nov 26 03:58:52 2005
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%@ page language="java" contentType="text/html; charset=utf-8" %>
+<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
+
+<html:html xhtml="true" lang="true">
+<head>
+    <link rel="stylesheet" type="text/css" href="css/example.css" />
+    <title>Wildcard Example Demonstrating Match One</title>
+</head>
+<body>
+<html:link action="SourceWildcard">
+    <img src="images/code.gif" width="24" height="24" alt="View Source" class="icon" />
+</html:link>
+<html:link action="Home">
+    <img src="images/return.gif" height="24" width="24" alt="Return to examples page" class="icon" />
+</html:link>
+<h1>Wildcard Mapping Example Results - Match One</h1>
+<p>
+    This page displays when the WildCard-Not link is selected,
+    even though the link also matches a wildcard mapping.
+</p>
+<h2>Press back</h2>
+</body>
+</html:html>
\ No newline at end of file

Added: struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Source.jsp
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Source.jsp?rev=349108&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Source.jsp (added)
+++ struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Source.jsp Sat Nov 26 03:58:52 2005
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%@ page language="java" contentType="text/html; charset=utf-8" %>
+<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Source Code for Wildcard Mappings Example</title>
+<html:xhtml/>
+<link rel="stylesheet" type="text/css" href="css/example.css" />
+</head>
+<body>
+<html:link action="/PrepareWildcard">
+   <img src="images/execute.gif" width="24" height="24" alt="Execute example" class="icon" />
+</html:link>
+<html:link action="/Home">
+   <img src="images/return.gif" height="24" width="24" alt="Return to examples page" class="icon" />
+</html:link>
+<h1>Source Code for Wildcard Example</h1>
+<hr noshade="noshade"/>
+
+<h2>JavaServer Pages</h2>
+<p>
+    <html:link page="/source.jsp?src=/jsp/Wildcard/MatchAny.jsp">
+        MatchAny.jsp
+    </html:link>
+</p>
+<p>
+    <html:link page="/source.jsp?src=/jsp/Wildcard/MatchOne.jsp">
+        MatchOne.jsp
+    </html:link>
+</p>
+
+<h2>Configuration file</h2>
+<p>
+    <html:link page="/source.jsp?src=/WEB-INF/struts-config-Wildcard.xml">
+        struts-config-Wildcard.xml
+    </html:link>
+</p>
+
+</body>
+</html>
\ No newline at end of file

Added: struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Wildcard.jsp
URL: http://svn.apache.org/viewcvs/struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Wildcard.jsp?rev=349108&view=auto
==============================================================================
--- struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Wildcard.jsp (added)
+++ struts/apps/trunk/cookbook/src/webapp/jsp/Wildcard/Wildcard.jsp Sat Nov 26 03:58:52 2005
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%@ page language="java" contentType="text/html; charset=utf-8" %>
+<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
+
+<html:html xhtml="true" lang="true">
+<head>
+    <link rel="stylesheet" type="text/css" href="css/example.css" />
+    <title>Wildcard Mappings Example</title>
+</head>
+<body>
+<p>
+<html:link action="SourceWildcard">
+  <img src="images/code.gif" width="24" height="24" alt="View Source" class="icon" />
+</html:link>
+<html:link action="Home">
+    <img src="images/return.gif" height="24" width="24" alt="Return to examples page" class="icon" />
+</html:link>
+<h1>Wildcard Example</h1>
+<hr noshade="noshade"/>
+<h2>Select a link. </h2>
+<ul>
+    <li>
+        <html:link action="Wildcard-Any">
+            This link demonstrates the Wildcard mapping feature.
+        </html:link>
+    </li>
+    <li>
+        <html:link action="Wildcard-Not">
+            This link demonstrates that a specific mapping will override a
+            less-specific Wildcard.
+        </html:link>
+    </li>
+</ul>
+</body>
+</html:html>
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org