Author: wesw
Date: Tue Mar 10 19:34:15 2009
New Revision: 752225

URL: http://svn.apache.org/viewvc?rev=752225&view=rev
Log:
adding datepicker to jquery theme, simple example -
form with textfield and datepicker + ajax validation + ajax response handling

Added:
    
struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction.java
    
struts/sandbox/trunk/s2-jquery-showcase/src/main/resources/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction-validation.xml
      - copied, changed from r752220, 
struts/sandbox/trunk/s2-jquery-showcase/src/main/resources/org/apache/struts2/jquery/actions/form/MessageAction-validation.xml
    
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker-input.jsp
    
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker.jsp
      - copied, changed from r752220, 
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/FormWithResetPostReqAjaxResp.jsp

Added: 
struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction.java
URL: 
http://svn.apache.org/viewvc/struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction.java?rev=752225&view=auto
==============================================================================
--- 
struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction.java
 (added)
+++ 
struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction.java
 Tue Mar 10 19:34:15 2009
@@ -0,0 +1,48 @@
+package org.apache.struts2.jquery.actions.form;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import java.util.Date;
+
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.InterceptorRef;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: wesw
+ * Date: Mar 10, 2009
+ * Time: 3:18:06 PM
+ * To change this template use File | Settings | File Templates.
+ */
+...@interceptorref("jsonValidationWorkflowStack")
+public class SimpleFormWithDatePickerAction extends ActionSupport {
+
+    private String msg ;
+    private Date date ;
+
+    @Override @Action("/form/simple-form-with-date-picker")
+    public String execute() {
+        return ActionSupport.SUCCESS;
+    }
+
+    @Override @Action("/form/simple-form-with-date-picker-input")
+    public String input() {
+        return ActionSupport.INPUT;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+}

Copied: 
struts/sandbox/trunk/s2-jquery-showcase/src/main/resources/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction-validation.xml
 (from r752220, 
struts/sandbox/trunk/s2-jquery-showcase/src/main/resources/org/apache/struts2/jquery/actions/form/MessageAction-validation.xml)
URL: 
http://svn.apache.org/viewvc/struts/sandbox/trunk/s2-jquery-showcase/src/main/resources/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction-validation.xml?p2=struts/sandbox/trunk/s2-jquery-showcase/src/main/resources/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction-validation.xml&p1=struts/sandbox/trunk/s2-jquery-showcase/src/main/resources/org/apache/struts2/jquery/actions/form/MessageAction-validation.xml&r1=752220&r2=752225&rev=752225&view=diff
==============================================================================
--- 
struts/sandbox/trunk/s2-jquery-showcase/src/main/resources/org/apache/struts2/jquery/actions/form/MessageAction-validation.xml
 (original)
+++ 
struts/sandbox/trunk/s2-jquery-showcase/src/main/resources/org/apache/struts2/jquery/actions/form/SimpleFormWithDatePickerAction-validation.xml
 Tue Mar 10 19:34:15 2009
@@ -6,4 +6,11 @@
           <message>You must enter a message.</message>
       </field-validator>
   </field>
+    <field name="date">
+      <field-validator type="date">
+          <param name="min">01/01/1900</param>
+          <param name="max">01/01/2000</param>
+          <message>You must enter a date before 2000.</message>
+      </field-validator>
+  </field>
 </validators>

Added: 
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker-input.jsp
URL: 
http://svn.apache.org/viewvc/struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker-input.jsp?rev=752225&view=auto
==============================================================================
--- 
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker-input.jsp
 (added)
+++ 
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker-input.jsp
 Tue Mar 10 19:34:15 2009
@@ -0,0 +1,24 @@
+<%@ taglib prefix="sjx" uri="/struts-jquery-tags" %>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
+<html>
+<head>
+<title>Hello World!</title>
+<sjx:head />
+    <script type="text/javascript">
+        function handleAjaxResponse(data, textStatus) {
+            $("#messages").append(data + "<br />\n");
+        }
+    </script>
+</head>
+<body>
+<sjx:form id="indexForm" method="post" validate="true"
+          namespace="/form" action="simple-form-with-date-picker"
+          ajaxResult="true" ajaxResultHandler="handleAjaxResponse" >
+<sjx:textfield key="msg" />
+<sjx:datepicker key="date" />
+<sjx:submit />
+<sjx:reset />
+</sjx:form>
+<div id="messages"></div>
+</body>
+</html>
\ No newline at end of file

Copied: 
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker.jsp
 (from r752220, 
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/FormWithResetPostReqAjaxResp.jsp)
URL: 
http://svn.apache.org/viewvc/struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker.jsp?p2=struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker.jsp&p1=struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/FormWithResetPostReqAjaxResp.jsp&r1=752220&r2=752225&rev=752225&view=diff
==============================================================================
--- 
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/FormWithResetPostReqAjaxResp.jsp
 (original)
+++ 
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/simple-form-with-date-picker.jsp
 Tue Mar 10 19:34:15 2009
@@ -1,2 +1,2 @@
 <%@ taglib prefix="s" uri="/struts-tags" %>
-your message - <s:property value="msg"/>
\ No newline at end of file
+your date - <s:property value="date"/>, your message - <s:property 
value="msg"/>
\ No newline at end of file


Reply via email to