struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject svn commit: r432776 - in /struts/sandbox/trunk/mailreader-course/struts2/hello/src: java/ java/tutorial/ webapp/tutorial/
Date Sat, 19 Aug 2006 00:15:57 GMT
Author: husted
Date: Fri Aug 18 17:15:54 2006
New Revision: 432776

URL: http://svn.apache.org/viewvc?rev=432776&view=rev
Log:
Add tutorial section to course, for website Step-by-Step material.

Added:
    struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName.java
    struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName2.java
    struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-error.html
    struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-success.jsp
    struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName.html
    struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2-success.jsp
    struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2.html
Modified:
    struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/struts.xml
    struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloWorld.java

Modified: struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/struts.xml
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/struts.xml?rev=432776&r1=432775&r2=432776&view=diff
==============================================================================
--- struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/struts.xml (original)
+++ struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/struts.xml Fri Aug 18 17:15:54
2006
@@ -18,9 +18,20 @@
     </package>
 
     <package name="tutorial" extends="struts-default">
+
         <action name="HelloWorld" class="tutorial.HelloWorld">
             <result name="success">/tutorial/HelloWorld.jsp</result>
         </action>
-    </package>
 
+        <action name="/HelloName" class="tutorial.HelloName">
+            <result name="success">/tutorial/HelloName-success.jsp</result>
+            <result name="error">/tutorial/HelloName-error.html</result>
+        </action>
+
+        <action name="/HelloName2" class="tutorial.HelloName2">
+            <result name="success">/tutorial/HelloName2-success.jsp</result>
+            <result name="error">/tutorial/HelloName-error.html</result>
+        </action>
+
+    </package>
 </struts>

Added: struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName.java?rev=432776&view=auto
==============================================================================
--- struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName.java
(added)
+++ struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName.java
Fri Aug 18 17:15:54 2006
@@ -0,0 +1,23 @@
+package tutorial;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class HelloName extends ActionSupport {
+
+    public String execute() throws Exception {
+        if (getName() == null || getName().length() == 0)
+            return ERROR;
+        else
+            return SUCCESS;
+    }
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}
\ No newline at end of file

Added: struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName2.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName2.java?rev=432776&view=auto
==============================================================================
--- struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName2.java
(added)
+++ struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloName2.java
Fri Aug 18 17:15:54 2006
@@ -0,0 +1,27 @@
+package tutorial;
+
+import com.opensymphony.xwork2.ActionSupport;
+import org.apache.struts2.interceptor.ParameterAware;
+
+import java.util.Map;
+
+public class HelloName2 extends ActionSupport implements ParameterAware {
+
+    public String execute() {
+        String[] name = (String[]) parameters.get("name");
+        if (name == null || name[0] == null || name[0].length() == 0)
+            return ERROR;
+        else
+            return SUCCESS;
+    }
+
+    Map parameters;
+
+    public Map getParameters() {
+        return parameters;
+    }
+
+    public void setParameters(Map parameters) {
+        this.parameters = parameters;
+    }
+}

Modified: struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloWorld.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloWorld.java?rev=432776&r1=432775&r2=432776&view=diff
==============================================================================
--- struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloWorld.java
(original)
+++ struts/sandbox/trunk/mailreader-course/struts2/hello/src/java/tutorial/HelloWorld.java
Fri Aug 18 17:15:54 2006
@@ -11,8 +11,6 @@
         message = "Hello, World!\n";
         message += "The time is:\n";
         message += DateFormat.getDateInstance().format(new Date());
-        ;
-
         return SUCCESS;
     }
 

Added: struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-error.html
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-error.html?rev=432776&view=auto
==============================================================================
--- struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-error.html
(added)
+++ struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-error.html
Fri Aug 18 17:15:54 2006
@@ -0,0 +1,10 @@
+<html>
+<head>
+    <title>Error Page</title>
+</head>
+<body>
+<p>
+Hmmm, you did not enter a name. Please try again!
+</p>
+</body>
+</html>

Added: struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-success.jsp
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-success.jsp?rev=432776&view=auto
==============================================================================
--- struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-success.jsp
(added)
+++ struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName-success.jsp
Fri Aug 18 17:15:54 2006
@@ -0,0 +1,11 @@
+<%@ taglib uri="/tags" prefix="s" %>
+<html>
+<head>
+    <title>Success Page</title>
+</head>
+<body>
+    <p>
+      Hello, <s:property value="name" />!
+    </p>
+</body>
+</html>

Added: struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName.html
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName.html?rev=432776&view=auto
==============================================================================
--- struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName.html
(added)
+++ struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName.html
Fri Aug 18 17:15:54 2006
@@ -0,0 +1,16 @@
+<html>
+<head>
+    <title>A simple HTML form with data</title>
+</head>
+
+<body>
+<p>What is your name?</p>
+
+<form action="/HelloName.action" method="post">
+    <p><input type="text" name="name"></p>
+
+    <p><input type="submit" value="Submit your name."/></p>
+</form>
+
+</body>
+</html>

Added: struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2-success.jsp
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2-success.jsp?rev=432776&view=auto
==============================================================================
--- struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2-success.jsp
(added)
+++ struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2-success.jsp
Fri Aug 18 17:15:54 2006
@@ -0,0 +1,12 @@
+<%@ taglib uri="/tags" prefix="s" %>
+<html>
+<head>
+    <title>Success Page - Without Using Getters and Setters</title>
+</head>
+
+<body>
+<p>
+    Hello, <s:property value="parameters.name"/>!
+</p>
+</body>
+</html>

Added: struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2.html
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2.html?rev=432776&view=auto
==============================================================================
--- struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2.html
(added)
+++ struts/sandbox/trunk/mailreader-course/struts2/hello/src/webapp/tutorial/HelloName2.html
Fri Aug 18 17:15:54 2006
@@ -0,0 +1,16 @@
+<html>
+<head>
+    <title>A simple HTML form with data</title>
+</head>
+
+<body>
+<p>What is your name?</p>
+
+<form action="/HelloName2.action" method="post">
+    <p><input type="text" name="name"></p>
+
+    <p><input type="submit" value="Submit your name."/></p>
+</form>
+
+</body>
+</html>



Mime
View raw message