struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r469983 - in /struts/struts2/trunk/apps/showcase/src/main: resources/org/apache/struts2/showcase/fileupload/FileUploadAction-validation.xml resources/struts-fileupload.xml webapp/fileupload/upload.jsp
Date Wed, 01 Nov 2006 16:58:21 GMT
Author: tmjee
Date: Wed Nov  1 08:58:20 2006
New Revision: 469983

URL: http://svn.apache.org/viewvc?view=rev&rev=469983
Log:
WW-1487
 - Updated fileupload showcase example in Struts2 that validate if the file uploaded is not
empty


Added:
    struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/fileupload/FileUploadAction-validation.xml
Modified:
    struts/struts2/trunk/apps/showcase/src/main/resources/struts-fileupload.xml
    struts/struts2/trunk/apps/showcase/src/main/webapp/fileupload/upload.jsp

Added: struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/fileupload/FileUploadAction-validation.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/fileupload/FileUploadAction-validation.xml?view=auto&rev=469983
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/fileupload/FileUploadAction-validation.xml
(added)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/org/apache/struts2/showcase/fileupload/FileUploadAction-validation.xml
Wed Nov  1 08:58:20 2006
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE validators PUBLIC 
+  		"-//OpenSymphony Group//XWork Validator 1.0.2//EN" 
+  		"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+	<field name="upload">
+		<field-validator type="fieldexpression">
+			<param name="expression"><![CDATA[upload.length() > 0]]></param>
+			<message>File cannot be empty</message>
+		</field-validator>
+	</field>
+	<field name="caption">
+		<field-validator type="requiredstring">
+			<message>Caption cannot be empty</message>
+		</field-validator>
+	</field>
+</validators>  		
+  		
\ No newline at end of file

Modified: struts/struts2/trunk/apps/showcase/src/main/resources/struts-fileupload.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts-fileupload.xml?view=diff&rev=469983&r1=469982&r2=469983
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts-fileupload.xml (original)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts-fileupload.xml Wed Nov  1
08:58:20 2006
@@ -12,6 +12,7 @@
 		</action>
 
         <action name="doUpload" class="org.apache.struts2.showcase.fileupload.FileUploadAction"
method="upload">
+        	<result name="input">upload.jsp</result>
 			<result>upload-success.jsp</result>
 		</action>
 		

Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/fileupload/upload.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/fileupload/upload.jsp?view=diff&rev=469983&r1=469982&r2=469983
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/fileupload/upload.jsp (original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/fileupload/upload.jsp Wed Nov  1 08:58:20
2006
@@ -11,6 +11,8 @@
 <body>
     <h1>Fileupload sample</h1>
 
+	<s:actionerror />
+	<s:fielderror />
     <s:form action="doUpload" method="POST" enctype="multipart/form-data">
         <s:file name="upload" label="File"/>
         <s:textfield name="caption" label="Caption"/>



Mime
View raw message