You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by hu...@apache.org on 2006/11/26 19:32:25 UTC
svn commit: r479396 - in /struts/struts2/trunk/apps/mailreader/src/main:
java/mailreader-default.xml java/mailreader2/MailreaderSupport.properties
java/struts.properties java/struts.xml webapp/Registration.jsp
webapp/Subscription.jsp webapp/tour.html
Author: husted
Date: Sun Nov 26 10:32:24 2006
New Revision: 479396
URL: http://svn.apache.org/viewvc?view=rev&rev=479396
Log:
WW-1458 Update mailreader to use constant configuration and latest tag idioms.
Removed:
struts/struts2/trunk/apps/mailreader/src/main/java/struts.properties
Modified:
struts/struts2/trunk/apps/mailreader/src/main/java/mailreader-default.xml
struts/struts2/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.properties
struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml
struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp
struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp
struts/struts2/trunk/apps/mailreader/src/main/webapp/tour.html
Modified: struts/struts2/trunk/apps/mailreader/src/main/java/mailreader-default.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/java/mailreader-default.xml?view=diff&rev=479396&r1=479395&r2=479396
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/java/mailreader-default.xml (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/java/mailreader-default.xml Sun Nov 26 10:32:24 2006
@@ -33,7 +33,7 @@
<global-results>
<result name="error">/pages/Error.jsp</result>
<result name="invalid.token">/pages/Error.jsp</result>
- <result name="login" type="redirect-action">Login!input</result>
+ <result name="login" type="redirect-action">Login_input</result>
</global-results>
<global-exception-mappings>
Modified: struts/struts2/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.properties
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.properties?view=diff&rev=479396&r1=479395&r2=479396
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.properties (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.properties Sun Nov 26 10:32:24 2006
@@ -55,25 +55,28 @@
option.imap=IMAP Protocol
option.pop3=POP3 Protocol
# prompt.
-autoConnect=Auto Connect
-fromAddress=From Address
-fullName=Full Name
-mailHostname=Mail Server
-mailPassword=Mail Password
-mailServerType=Server Type
-mailUsername=Mail Username
+host=Mail Server
password=Password
password2=(Repeat) Password
-replyToAddress=Reply To Address
username=Username
+
registration.addSubscription=Add
registration.deleteSubscription=Delete
registration.editSubscription=Edit
registration.title.create=Register for the MailReader Demonstration Application
registration.title.edit=Edit Registration for the MailReader Demonstration Application
+
+subscription.autoConnect=Auto Connect
+subscription.password=Mail Password
+subscription.type=Server Type
+subscription.username=Mail Username
subscription.title.create=Create New Mail Subscription
subscription.title.delete=Delete Existing Mail Subscription
subscription.title.edit=Edit Existing Mail Subscription
+
+user.fromAddress=From Address
+user.fullName=Full Name
+user.replyToAddress=Reply To Address
# Standard error messages for validator framework checks
errors.required=${getText(fieldName)} is required.
Modified: struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml?view=diff&rev=479396&r1=479395&r2=479396
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/java/struts.xml Sun Nov 26 10:32:24 2006
@@ -5,6 +5,11 @@
<struts>
+ <constant name="struts.action.extension" value="do" />
+ <constant name="struts.devMode" value="false" />
+ <constant name="struts.enable.DynamicMethodInvocation" value="false" />
+ <constant name="struts.objectFactory" value="spring" />
+
<include file="mailreader-default.xml"/>
<include file="mailreader-support.xml"/>
Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp?view=diff&rev=479396&r1=479395&r2=479396
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/Registration.jsp Sun Nov 26 10:32:24 2006
@@ -14,7 +14,7 @@
type="text/css"/>
</head>
-<body onLoad="self.focus();document.Registration.username.focus()">
+<body onLoad="self.focus();document.Registration_save_username.focus()">
<s:actionerror/>
<s:form action="Registration_save" validate="false">
@@ -29,31 +29,20 @@
</s:else>
<s:password key="password"/>
-
<s:password key="password2"/>
-
- <s:textfield key="fullName"
- name="user.fullName"/>
-
- <s:textfield key="fromAddress"
- name="user.fromAddress"/>
-
- <s:textfield key="replyToAddress"
- name="user.replyToAddress"/>
+ <s:textfield key="user.fullName"/>
+ <s:textfield key="user.fromAddress"/>
+ <s:textfield key="user.replyToAddress"/>
<s:if test="task == 'Create'">
<s:submit key="button.save" action="Registration_save"/>
-
<s:reset key="button.reset"/>
-
<s:submit action="Welcome" key="button.cancel"
onclick="form.onsubmit=null"/>
</s:if>
<s:else>
<s:submit key="button.save" action="Registration"/>
-
<s:reset key="button.reset"/>
-
<s:submit action="MainMenu" key="button.cancel"
onclick="form.onsubmit=null"/>
</s:else>
Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp?view=diff&rev=479396&r1=479395&r2=479396
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/Subscription.jsp Sun Nov 26 10:32:24 2006
@@ -26,33 +26,25 @@
<s:label key="username" name="user.username"/>
<s:if test="task == 'Create'">
- <s:textfield key="mailHostname" name="host"/>
+ <s:textfield key="host"/>
</s:if>
<s:else>
- <s:label key="mailHostname" name="host"/>
+ <s:label key="host"/>
<s:hidden name="host"/>
</s:else>
<s:if test="task == 'Delete'">
- <s:label key="mailUsername"
- name="subscription.username"/>
- <s:label key="mailPassword"
- name="subscription.password"/>
- <s:label key="mailServerType"
- name="subscription.type"/>
- <s:label key="autoConnect"
- name="subscription.autoConnect"/>
+ <s:label key="subscription.username"/>
+ <s:label key="subscription.password"/>
+ <s:label key="subscription.type"/>
+ <s:label key="subscription.autoConnect"/>
<s:submit key="button.confirm"/>
</s:if>
<s:else>
- <s:textfield key="mailUsername"
- name="subscription.username"/>
- <s:textfield key="mailPassword"
- name="subscription.password"/>
- <s:select key="mailServerType"
- name="subscription.type" list="types"/>
- <s:checkbox key="autoConnect"
- name="subscription.autoConnect"/>
+ <s:textfield key="subscription.username"/>
+ <s:textfield key="subscription.password"/>
+ <s:select key="subscription.type" list="types"/>
+ <s:checkbox key="subscription.autoConnect"/>
<s:submit key="button.save"/>
<s:reset key="button.reset"/>
</s:else>
Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/tour.html
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/tour.html?view=diff&rev=479396&r1=479395&r2=479396
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/tour.html (original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/tour.html Sun Nov 26 10:32:24 2006
@@ -450,7 +450,7 @@
<pre><code> <global-results>
<result name=<strong>"error"</strong>><strong>/pages/Error.jsp</strong></result>
<result name="invalid.token">/pages/Error.jsp</result>
- <result name="login" type="redirect-action">Login!input</result>
+ <result name="login" type="redirect-action">Login_input</result>
</global-results></code></pre>
<hr/>
@@ -572,9 +572,9 @@
<h3><s:text name="index.heading"/></h3>
<ul>
- <li><a href="<s:url action="Registration!input"/>"><s:text
+ <li><a href="<s:url action="Registration_input"/>"><s:text
name="index.registration"/></a></li>
- <li><a href="<s:url action="Login!input"/>"><s:text
+ <li><a href="<s:url action="Login_input"/>"><s:text
name="index.login"/></a></li>
</ul>
@@ -729,12 +729,12 @@
<body onLoad="self.focus();document.Login.username.focus()">
<strong><s:actionerror/></strong>
<strong><s:form action="Login" validate="true"></strong>
- <strong><s:textfield label="%{getText('username')}" name="username"/></strong>
- <strong><s:password label="%{getText('password')}" name="password"/></strong>
- <strong><s:submit value="%{getText('button.save')}"/></strong>
- <strong><s:reset value="%{getText('button.reset')}"/></strong>
- <s:submit <strong>action="Login!cancel" onclick="form.onsubmit=null"</strong>
- value="%{getText('button.cancel')}"/>
+ <strong><s:textfield key="username"/></strong>
+ <strong><s:password key="password"/></strong>
+ <strong><s:submit key="button.save"/></strong>
+ <strong><s:reset key="button.reset"/></strong>
+ <s:submit <strong>action="Login_cancel" onclick="form.onsubmit=null"</strong>
+ key="button.cancel"/>
</s:form>
<jsp:include page="Footer.jsp"/>
</body>
@@ -793,7 +793,7 @@
</p>
<pre><code>
- <s:<strong>textfield</strong> label="%{getText('username')}" name="username"/>
+ <s:<strong>textfield</strong> key="username"/>
</code></pre>
<p>
@@ -875,13 +875,13 @@
The second submit button is more interesting.
</p>
-<pre><code> <s:submit <strong>action="Login!cancel" onclick="form.onsubmit=null"</strong>
- value="%{getText('button.cancel')}"/>
+<pre><code> <s:submit <strong>action="Login_cancel" onclick="form.onsubmit=null"</strong>
+ key="button.cancel"/>
</code></pre>
<p>
Here we are creating the Cancel button for the form.
- The button's attribute <em>action="Login<strong>!</strong>cancel"</em>
+ The button's attribute <em>action="Login<strong>_</strong>cancel"</em>
tells the framework to submit to the Login's "cancel" method
instead of the usual "execute" method.
The <em>onclick="form.onsubmit=null"</em> script defeats client-side validation.
@@ -1262,7 +1262,7 @@
<hr/>
<h5>mailreader-support.xml Login</h5>
-<pre><code><action name="<strong>Login!*</strong>" method="{1}" class="mailreader2.Login">
+<pre><code><action name="<strong>Login_*</strong>" method="{1}" class="mailreader2.Login">
<result name="<strong>input</strong>">/pages/Login.jsp</result>
<result name="<strong>cancel</strong>" type="redirect-action">Welcome</result>
<result type="redirect-action">MainMenu</result>
@@ -1276,13 +1276,13 @@
<p>
You might notice that the name of the Login action element is not "Login"
- but "Login<strong>!*</strong>".
+ but "Login<strong>_*</strong>".
The asterisk is a special "wildcard" notation that tells the framework to match any series
of character at this point.
In the method attribute,
the "{1}" notation indicates that framework should substitute whatever characters match
the asterisk at runtime.
- When we cite actions like "Login!cancel" or "Login!input",
+ When we cite actions like "Login_cancel" or "Login_input",
the framework matches "cancel" or "input" with the wildcard and fills in the blanks.
</p>
@@ -1571,7 +1571,7 @@
<h3><s:text name="mainMenu.heading"/> <strong><s:property
value="user.fullName"/></strong></h3>
<ul>
- <li><a href="<s:url <strong>action="Registration!input"</strong> />">
+ <li><a href="<s:url <strong>action="Registration_input"</strong> />">
<s:text name="mainMenu.registration"/>
</a>
</li>
@@ -1718,10 +1718,10 @@
<s:property value="<strong>autoConnect</strong>"/>
</td>
<td align="center">
- <a href="<s:url action="<strong>Subscription!delete</strong>"><s:param name="<strong>host</strong>" value="host"/></s:url>">
+ <a href="<s:url action="<strong>Subscription_delete</strong>"><s:param name="<strong>host</strong>" value="host"/></s:url>">
<s:text name="registration.deleteSubscription"/>
</a>
- <a href="<s:url action="<strong>Subscription!edit</strong>"><s:param name="<strong>host</strong>" value="host"/></s:url>">
+ <a href="<s:url action="<strong>Subscription_edit</strong>"><s:param name="<strong>host</strong>" value="host"/></s:url>">
<s:text name="registration.editSubscription"/>
</a>
</td>
@@ -1773,11 +1773,11 @@
false
</td>
<td align="center">
- <a href="/struts2-mailreader/Subscription!delete.do?host=mail.hotmail.com">
+ <a href="/struts2-mailreader/Subscription_delete.do?host=mail.hotmail.com">
Delete
</a>
- <a href="/struts2-mailreader/Subscription!edit.do?host=mail.hotmail.com">
+ <a href="/struts2-mailreader/Subscription_edit.do?host=mail.hotmail.com">
Edit
</a>
</td>
@@ -1796,17 +1796,17 @@
false
</td>
<td align="center">
- <a href="/struts2-mailreader/Subscription!delete.do?host=mail.yahoo.com">
+ <a href="/struts2-mailreader/Subscription_delete.do?host=mail.yahoo.com">
Delete
</a>
- <a href="/struts2-mailreader/Subscription!edit.do?host=mail.yahoo.com">
+ <a href="/struts2-mailreader/Subscription_edit.do?host=mail.yahoo.com">
Edit
</a>
</td>
</tr>
</table>
- <a href="/struts2-mailreader/Subscription!input.do">Add</a>
+ <a href="/struts2-mailreader/Subscription_input.do">Add</a>
<hr />
@@ -1928,7 +1928,7 @@
</p>
<pre><code>
- <s:url action="Subscription!edit"><s:param name="<strong>host" value="host</strong>"/></s:url>">
+ <s:url action="Subscription_edit"><s:param name="<strong>host" value="host</strong>"/></s:url>">
</code></pre>
<p>
@@ -1936,7 +1936,7 @@
</p>
<pre><code>
- <a href="/struts2-mailreader/Subscription!edit.do?<strong>host=mail.yahoo.com</strong>">Edit</a>
+ <a href="/struts2-mailreader/Subscription_edit.do?<strong>host=mail.yahoo.com</strong>">Edit</a>
</code></pre>
<!--
@@ -1967,16 +1967,16 @@
<hr />
<h5>mailreader-support.xml Subscription element</h5>
-<pre><code><action name="Subscription!*" method="{1}" class="mailreader2.Subscription">
+<pre><code><action name="Subscription_*" method="{1}" class="mailreader2.Subscription">
<result name="input">/pages/Subscription.jsp</result>
- <result type="redirect-action">Registration!input</result>
+ <result type="redirect-action">Registration_input</result>
</action></code></pre>
<hr />
<p>
The Edit link specified the Subscription action,
- but also includes the qualifier <strong>!edit</strong>.
- The wildcard notation tells the framework to use any characters given after "Subscription!"
+ but also includes the qualifier <strong>_edit</strong>.
+ The wildcard notation tells the framework to use any characters given after "Subscription_"
as the name of a method to invoke on the Action class,
instead of the default execute method.
The "alternate" execute methods are called <strong>alias</strong> methods.
@@ -2107,45 +2107,37 @@
<body onLoad="self.focus();document.Subscription.username.focus()">
<s:actionerror/>
- <s:form <strong>action="Subscription!save"</strong> validate="true">
+ <s:form <strong>action="Subscription_save"</strong> validate="true">
<strong><s:token /></strong>
<strong><s:hidden name="task"/></strong>
- <strong><s:label label="%{getText('username')}" name="user.username"/></strong>
+ <strong><s:label key="username" name="user.username"/></strong>
<s:if test="task == 'Create'">
- <s:textfield label="%{getText('mailHostname')}" name="host"/>
+ <s:textfield key="mailHostname" name="host"/>
</s:if>
<s:else>
- <s:label label="%{getText('mailHostname')}" name="host"/>
+ <s:label key="mailHostname" name="host"/>
<s:hidden name="host"/>
</s:else>
<s:if test="task == 'Delete'">
- <s:label label="%{getText('mailUsername')}"
- name="subscription.username"/>
- <s:label label="%{getText('mailPassword')}"
- name="subscription.password"/>
- <s:label label="%{getText('mailServerType')}"
- name="subscription.type"/>
- <s:label label="%{getText('autoConnect')}"
- name="subscription.autoConnect"/>
- <s:submit value="%{getText('button.confirm')}"/>
+ <s:label key="subscription.username"/>
+ <s:label key="subscription.password"/>
+ <s:label key="subscription.type"/>
+ <s:label key="subscription.autoConnect"/>
+ <s:submit key="button.confirm"/>
</s:if>
<s:else>
- <s:textfield label="%{getText('mailUsername')}"
- name="subscription.username"/>
- <s:textfield label="%{getText('mailPassword')}"
- name="subscription.password"/>
- <strong><s:select label="%{getText('mailServerType')}"
- name="subscription.type" list="types"/></strong>
- <strong><s:checkbox label="%{getText('autoConnect')}"
- name="subscription.autoConnect"/></strong>
- <s:submit value="%{getText('button.save')}"/>
- <s:reset value="%{getText('button.reset')}"/>
+ <s:textfield key="subscription.username"/>
+ <s:textfield key="subscription.password"/>
+ <strong><s:select key="subscription.type" list="types"/></strong>
+ <strong><s:checkbox key="subscription.autoConnect"/></strong>
+ <s:submit key="button.save"/>
+ <s:reset key="button.reset"/>
</s:else>
- <s:submit action="Registration!input"
- value="%{getText('button.cancel')}"
+ <s:submit action="Registration_input"
+ key="button.cancel"
onclick="form.onsubmit=null"/>
</s:form>
@@ -2169,7 +2161,7 @@
<p>
The <strong>hidden</strong> tag embeds the Task property into the form.
When the form is submitted,
- the Subscription!save action will use the Task property to decide
+ the Subscription_save action will use the Task property to decide
whether to insert or update the form.
</p>
@@ -2192,8 +2184,7 @@
but the tag does so without requiring a lot of markup or redtape.
</p>
-<pre><code><s:select label="%{getText('mailServerType')}"
- name="subscription.type" <strong>list="types"</strong> />
+<pre><code><s:select key="subscription.type" <strong>list="types"</strong> />
</code></pre>
<p>
@@ -2286,13 +2277,13 @@
<p>
If we press the SAVE button,
- the form will be submitted to the Subscription!save action.
+ the form will be submitted to the Subscription_save action.
Since the save method needs some additional validation,
we can add a validation file.
</p>
<hr />
-<h5>Subscription-Subscription!save-validation.xml</h5>
+<h5>Subscription-Subscription_save-validation.xml</h5>
<pre><code><!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
@@ -2307,7 +2298,7 @@
<p>
The validators follow the same type of inheritance path as the classes.
SubscriptionSave extends Subscription,
- so when Subscription!save is validated,
+ so when Subscription_save is validated,
the Host property specified by "Subscription-validation.xml" will also be required.
</p>
@@ -2433,14 +2424,14 @@
<global-results>
<result name="input">/Subscription.jsp</result>
- <result type="redirect-action">Registration!input</result>
+ <result type="redirect-action">Registration_input</result>
</global-results>
- <action name="Subscription!save" method="save" class="mailreader2.Subscription">
+ <action name="Subscription_save" method="save" class="mailreader2.Subscription">
<interceptor-ref name="user-submit" />
</action>
- <action name="Subscription!*" method="{1}" class="mailreader2.Subscription" />
+ <action name="Subscription_*" method="{1}" class="mailreader2.Subscription" />
</package>
@@ -2474,6 +2465,6 @@
<p>
Enjoy!
</p>
-
+</blockquote>
</body>
</html>