You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by mr...@apache.org on 2003/10/25 03:37:12 UTC
cvs commit: jakarta-struts/web/example/WEB-INF action.xml struts-config-registration.xml validation.xml
mrdon 2003/10/24 18:37:12
Modified: src/example/org/apache/struts/webapp/example
EditRegistrationAction.java
web/example/WEB-INF action.xml
struts-config-registration.xml validation.xml
Added: web/example Registration.jsp
Removed: web/example registration.jsp
Log:
Updated the struts-example webapp to include the usage of wildcards in
action mappings
Revision Changes Path
1.15 +5 -5 jakarta-struts/src/example/org/apache/struts/webapp/example/EditRegistrationAction.java
Index: EditRegistrationAction.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/example/org/apache/struts/webapp/example/EditRegistrationAction.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- EditRegistrationAction.java 4 Sep 2003 16:03:42 -0000 1.14
+++ EditRegistrationAction.java 25 Oct 2003 01:37:11 -0000 1.15
@@ -145,7 +145,7 @@
* Since this Action has a RegistrationForm attribute, struts has
* already created the form. The check below is just to guard against
* a null pointer exception in case someone inadvertently removes the
- * attribute="registrationForm" from struts-config-registration.xml
+ * attribute="RegistrationForm" from struts-config-registration.xml
*/
if (form == null) {
if (log.isTraceEnabled()) {
1.1 jakarta-struts/web/example/Registration.jsp
Index: Registration.jsp
===================================================================
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Edit">
<app:checkLogon/>
</logic:equal>
<html:html>
<head>
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Create">
<title><bean:message key="registration.title.create"/></title>
</logic:equal>
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Edit">
<title><bean:message key="registration.title.edit"/></title>
</logic:equal>
<html:base/>
</head>
<body bgcolor="white">
<html:errors/>
<html:form action="/saveRegistration"
onsubmit="return validateRegistrationForm(this);">
<html:hidden property="action"/>
<table border="0" width="100%">
<tr>
<th align="right">
<bean:message key="prompt.username"/>:
</th>
<td align="left">
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Create">
<html:text property="username" size="16" maxlength="16"/>
</logic:equal>
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Edit">
<%--
<bean:write name="RegistrationForm" property="username"
scope="request" filter="true"/>
--%>
<html:hidden property="username" write="true"/>
</logic:equal>
</td>
</tr>
<tr>
<th align="right">
<bean:message key="prompt.password"/>:
</th>
<td align="left">
<html:password property="password" size="16" maxlength="16"/>
</td>
</tr>
<tr>
<th align="right">
<bean:message key="prompt.password2"/>:
</th>
<td align="left">
<html:password property="password2" size="16" maxlength="16"/>
</td>
</tr>
<tr>
<th align="right">
<bean:message key="prompt.fullName"/>:
</th>
<td align="left">
<html:text property="fullName" size="50"/>
</td>
</tr>
<tr>
<th align="right">
<bean:message key="prompt.fromAddress"/>:
</th>
<td align="left">
<html:text property="fromAddress" size="50"/>
</td>
</tr>
<tr>
<th align="right">
<bean:message key="prompt.replyToAddress"/>:
</th>
<td align="left">
<html:text property="replyToAddress" size="50"/>
</td>
</tr>
<tr>
<td align="right">
<html:submit>
<bean:message key="button.save"/>
</html:submit>
</td>
<td align="left">
<html:reset>
<bean:message key="button.reset"/>
</html:reset>
<html:cancel>
<bean:message key="button.cancel"/>
</html:cancel>
</td>
</tr>
</table>
</html:form>
<logic:equal name="RegistrationForm" property="action"
scope="request" value="Edit">
<div align="center">
<h3><bean:message key="heading.subscriptions"/></h3>
</div>
<table border="1" width="100%">
<tr>
<th align="center" width="30%">
<bean:message key="heading.host"/>
</th>
<th align="center" width="25%">
<bean:message key="heading.user"/>
</th>
<th align="center" width="10%">
<bean:message key="heading.type"/>
</th>
<th align="center" width="10%">
<bean:message key="heading.autoConnect"/>
</th>
<th align="center" width="15%">
<bean:message key="heading.action"/>
</th>
</tr>
<logic:iterate id="subscription" name="user" property="subscriptions">
<tr>
<td align="left">
<bean:write name="subscription" property="host" filter="true"/>
</td>
<td align="left">
<bean:write name="subscription" property="username" filter="true"/>
</td>
<td align="center">
<bean:write name="subscription" property="type" filter="true"/>
</td>
<td align="center">
<bean:write name="subscription" property="autoConnect"/>
</td>
<td align="center">
<app:linkSubscription page="/editSubscription.do?action=Delete">
<bean:message key="registration.deleteSubscription"/>
</app:linkSubscription>
<app:linkSubscription page="/editSubscription.do?action=Edit">
<bean:message key="registration.editSubscription"/>
</app:linkSubscription>
</td>
</tr>
</logic:iterate>
</table>
<html:link page="/editSubscription.do?action=Create" paramId="username"
paramName="RegistrationForm" paramProperty="username">
<bean:message key="registration.addSubscription"/>
</html:link>
</logic:equal>
<html:javascript formName="RegistrationForm"
dynamicJavascript="true"
staticJavascript="false"/>
<script language="Javascript1.1" src="staticJavascript.jsp"></script>
</body>
</html:html>
1.9 +4 -4 jakarta-struts/web/example/WEB-INF/action.xml
Index: action.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/web/example/WEB-INF/action.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- action.xml 11 Apr 2001 02:08:20 -0000 1.8
+++ action.xml 25 Oct 2003 01:37:12 -0000 1.9
@@ -16,9 +16,9 @@
<!-- Edit user registration -->
<action path="/editRegistration"
actionClass="org.apache.struts.webapp.example.EditRegistrationAction"
- formAttribute="registrationForm"
+ formAttribute="RegistrationForm"
formClass="org.apache.struts.webapp.example.RegistrationForm">
- <forward name="success" path="/registration.jsp"/>
+ <forward name="success" path="/Registration.jsp"/>
</action>
<!-- Edit mail subscription -->
@@ -48,9 +48,9 @@
<!-- Save user registration -->
<action path="/saveRegistration"
actionClass="org.apache.struts.webapp.example.SaveRegistrationAction"
- formAttribute="registrationForm"
+ formAttribute="RegistrationForm"
formClass="org.apache.struts.webapp.example.RegistrationForm"
- inputForm="/registration.jsp">
+ inputForm="/Registration.jsp">
<forward name="success" path="/mainMenu.jsp"/>
</action>
1.4 +12 -12 jakarta-struts/web/example/WEB-INF/struts-config-registration.xml
Index: struts-config-registration.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/web/example/WEB-INF/struts-config-registration.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- struts-config-registration.xml 10 Aug 2003 02:52:55 -0000 1.3
+++ struts-config-registration.xml 25 Oct 2003 01:37:12 -0000 1.4
@@ -19,34 +19,34 @@
<form-beans>
<!-- Registration form bean -->
- <form-bean name="registrationForm"
+ <form-bean name="RegistrationForm"
type="org.apache.struts.webapp.example.RegistrationForm"/>
</form-beans>
<!-- ========== Global Forward Definitions ============================== -->
<global-forwards>
- <forward name="registration" path="/registration.jsp"/>
+ <forward name="Registration" path="/Registration.jsp"/>
</global-forwards>
<!-- ========== Action Mapping Definitions ============================== -->
<action-mappings>
- <!-- Edit user registration -->
- <action path="/editRegistration"
- type="org.apache.struts.webapp.example.EditRegistrationAction"
- attribute="registrationForm"
+ <!-- Matches all edit actions (in this case, only user regstration) -->
+ <action path="/edit*"
+ type="org.apache.struts.webapp.example.Edit{1}Action"
+ attribute="{1}Form"
scope="request"
validate="false">
- <forward name="success" path="/registration.jsp"/>
+ <forward name="success" path="/{1}.jsp"/>
</action>
- <!-- Save user registration -->
- <action path="/saveRegistration"
- type="org.apache.struts.webapp.example.SaveRegistrationAction"
- name="registrationForm"
+ <!-- Matches all save actions (in this case, only user registration) -->
+ <action path="/save*"
+ type="org.apache.struts.webapp.example.Save{1}Action"
+ name="{1}Form"
scope="request"
- input="registration"/>
+ input="{1}"/>
</action-mappings>
1.10 +2 -2 jakarta-struts/web/example/WEB-INF/validation.xml
Index: validation.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/web/example/WEB-INF/validation.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- validation.xml 22 Sep 2003 01:50:01 -0000 1.9
+++ validation.xml 25 Oct 2003 01:37:12 -0000 1.10
@@ -55,7 +55,7 @@
</form>
- <form name="registrationForm">
+ <form name="RegistrationForm">
<field property="fromAddress"
depends="required,email">
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org