You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by tm...@apache.org on 2006/10/08 15:59:49 UTC
svn commit: r454144 - in /struts/struts2/trunk/apps/showcase/src/main:
java/org/apache/struts2/showcase/ajax/ resources/
resources/org/apache/struts2/showcase/ajax/ webapp/ajax/tabbedpanel/
Author: tmjee
Date: Sun Oct 8 06:59:49 2006
New Revision: 454144
URL: http://svn.apache.org/viewvc?view=rev&rev=454144
Log:
WW-1453
- added an ajax validation example using tabpanel
- its basically a tabbedpanel having in it a remote (ajax) form that does ajax-style validation as there's a question being posted in the forum related to this.
Added:
struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java
struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/ajax/
struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/ajax/Example5Action-validation.xml
struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5.jsp
struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5Ok.jsp
Modified:
struts/struts2/trunk/apps/showcase/src/main/resources/struts-ajax.xml
Added: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java?view=auto&rev=454144
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java (added)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java Sun Oct 8 06:59:49 2006
@@ -0,0 +1,23 @@
+package org.apache.struts2.showcase.ajax;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class Example5Action extends ActionSupport {
+
+ private static final long serialVersionUID = 2111967621952300611L;
+
+ private String name;
+ private Integer age;
+
+
+ public String getName() { return name; }
+ public void setName(String name) { this.name = name; }
+
+ public Integer getAge() { return age; }
+ public void setAge(Integer age) { this.age = age; }
+
+ @Override
+ public String execute() throws Exception {
+ return SUCCESS;
+ }
+}
Added: struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/ajax/Example5Action-validation.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/ajax/Example5Action-validation.xml?view=auto&rev=454144
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/ajax/Example5Action-validation.xml (added)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/ajax/Example5Action-validation.xml Sun Oct 8 06:59:49 2006
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="name">
+ <field-validator type="requiredstring">
+ <message>Name is required</message>
+ </field-validator>
+ </field>
+ <field name="age">
+ <field-validator type="required">
+ <message>Age is required</message>
+ </field-validator>
+ </field>
+</validators>
+
+
Modified: struts/struts2/trunk/apps/showcase/src/main/resources/struts-ajax.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts-ajax.xml?view=diff&rev=454144&r1=454143&r2=454144
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts-ajax.xml (original)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts-ajax.xml Sun Oct 8 06:59:49 2006
@@ -46,6 +46,10 @@
<result type="freemarker">/ajax/tabbedpanel/example4.ftl</result>
</action>
+ <action name="example5" class="org.apache.struts2.showcase.ajax.Example5Action">
+ <result name="input">/ajax/tabbedpanel/example5.jsp</result>
+ <result>/ajax/tabbedpanel/example5Ok.jsp</result>
+ </action>
</package>
<package name="ajaxNoDecorate" namespace="/nodecorate" extends="struts-default">
Added: struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5.jsp?view=auto&rev=454144
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5.jsp Sun Oct 8 06:59:49 2006
@@ -0,0 +1,27 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Insert title here</title>
+
+<link rel="stylesheet" type="text/css" href="<s:url value='/struts/tabs.css' />" />
+<s:head theme="ajax" />
+</head>
+<body>
+<s:url id="url" action="example5" namespace="/nodecorate" includeContext="false" />
+<s:tabbedPanel id="tp" theme="ajax">
+ <s:panel id="t1" tabName="Tab 1" href="%{#url}">
+ <s:form action="example5" namespace="" theme="ajax" validate="true" >
+ <s:textfield label="Name" name="name" theme="ajax" />
+ <s:textfield label="Age" name="age" theme="ajax" />
+ <s:submit />
+ </s:form>
+ </s:panel>
+</s:tabbedPanel>
+
+</body>
+</html>
+
Added: struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5Ok.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5Ok.jsp?view=auto&rev=454144
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5Ok.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/tabbedpanel/example5Ok.jsp Sun Oct 8 06:59:49 2006
@@ -0,0 +1,9 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<h1>OK</h1>
+<s:property value="name" /><br/>
+<s:property value="age" /><br/>
+
+
\ No newline at end of file