|
|
|
@@ -450,7 +450,7 @@ public class Welcome extends MailreaderSupport {
|
|
|
|
|
<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 @@ public class Welcome extends MailreaderSupport {
|
|
|
|
|
<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 @@ public class Welcome extends MailreaderSupport {
|
|
|
|
|
<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 @@ public class Welcome extends MailreaderSupport {
|
|
|
|
|
</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 @@ public class Welcome extends MailreaderSupport {
|
|
|
|
|
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 @@ public void <strong>setSession(Map value)</strong> {
|
|
|
|
|
|
|
|
|
|
<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 @@ public void <strong>setSession(Map value)</strong> {
|
|
|
|
|
|
|
|
|
|
<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 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
|
|
|
|
<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 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
|
|
|
|
<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 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
|
|
|
|
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 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
|
|
|
|
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 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
|
|
|
|
</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 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
|
|
|
|
</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 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
|
|
|
|
|
|
|
|
|
<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 @@ public Subscription findSubscription(String host) {
|
|
|
|
|
<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 @@ public Subscription findSubscription(String host) {
|
|
|
|
|
<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 @@ public Subscription findSubscription(String host) {
|
|
|
|
|
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 @@ public Subscription findSubscription(String host) {
|
|
|
|
|
|
|
|
|
|
<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 @@ public Subscription findSubscription(String host) {
|
|
|
|
|
<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 @@ public Subscription findSubscription(String host) {
|
|
|
|
|
|
|
|
|
|
<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 @@ public Subscription findSubscription(String host) {
|
|
|
|
|
<p>
|
|
|
|
|
Enjoy!
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
</blockquote>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|