struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-struts/web/example/WEB-INF validation.xml struts-config.xml
Date Sun, 14 Jul 2002 01:35:18 GMT
craigmcc    2002/07/13 18:35:18

  Modified:    .        build-webapps.xml
               src/example/org/apache/struts/webapp/example
                        ApplicationResources.properties
               web/example logon.jsp registration.jsp subscription.jsp
               web/example/WEB-INF struts-config.xml
  Added:       web/example staticJavascript.jsp
               web/example/WEB-INF validation.xml
  Log:
  Incorporate the validation framework into the logon page of the standard
  Struts example webapp.
  
  FIXME:  For some reason, the error message created for the maxlength check
  says "Username can not be greater than null characters".
  
  Revision  Changes    Path
  1.15      +3 -0      jakarta-struts/build-webapps.xml
  
  Index: build-webapps.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/build-webapps.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- build-webapps.xml	6 Jul 2002 01:36:04 -0000	1.14
  +++ build-webapps.xml	14 Jul 2002 01:35:18 -0000	1.15
  @@ -131,6 +131,9 @@
       <!-- Copy validator-rules.xml for the Struts validator application -->
       <copy tofile="${build.home}/validator/WEB-INF/validator-rules.xml"
               file="${basedir}/conf/share/validator-rules.xml"/>
  +    <!-- Copy validator-rules.xml for the Struts example application -->
  +    <copy tofile="${build.home}/example/WEB-INF/validator-rules.xml"
  +            file="${basedir}/conf/share/validator-rules.xml"/>
       <!-- Copy validator-rules.xml for the Struts blank application -->
       <copy tofile="${build.home}/blank/WEB-INF/validator-rules.xml"
               file="${basedir}/conf/share/validator-rules.xml"/>
  
  
  
  1.7       +27 -11    jakarta-struts/src/example/org/apache/struts/webapp/example/ApplicationResources.properties
  
  Index: ApplicationResources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/example/org/apache/struts/webapp/example/ApplicationResources.properties,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ApplicationResources.properties	16 Jun 2002 05:11:35 -0000	1.6
  +++ ApplicationResources.properties	14 Jul 2002 01:35:18 -0000	1.7
  @@ -49,17 +49,17 @@
   mainMenu.title=MailReader Demonstration Application - Main Menu
   option.imap=IMAP Protocol
   option.pop3=POP3 Protocol
  -prompt.autoConnect=Auto Connect:
  -prompt.fromAddress=From Address:
  -prompt.fullName=Full Name:
  -prompt.mailHostname=Mail Server:
  -prompt.mailPassword=Mail Password:
  -prompt.mailServerType=Server Type:
  -prompt.mailUsername=Mail Username:
  -prompt.password=Password:
  -prompt.password2=(Repeat) Password:
  -prompt.replyToAddress=Reply To Address:
  -prompt.username=Username:
  +prompt.autoConnect=Auto Connect
  +prompt.fromAddress=From Address
  +prompt.fullName=Full Name
  +prompt.mailHostname=Mail Server
  +prompt.mailPassword=Mail Password
  +prompt.mailServerType=Server Type
  +prompt.mailUsername=Mail Username
  +prompt.password=Password
  +prompt.password2=(Repeat) Password
  +prompt.replyToAddress=Reply To Address
  +prompt.username=Username
   registration.addSubscription=Add
   registration.deleteSubscription=Delete
   registration.editSubscription=Edit
  @@ -68,3 +68,19 @@
   subscription.title.create=Create New Mail Subscription
   subscription.title.delete=Delete Existing Mail Subscription
   subscription.title.edit=Edit Existing Mail Subscription
  +
  +# Standard error messages for validator framework checks
  +errors.required={0} is required.
  +errors.minlength={0} can not be less than {1} characters.
  +errors.maxlength={0} can not be greater than {1} characters.
  +errors.invalid={0} is invalid.
  +errors.byte={0} must be an byte.
  +errors.short={0} must be an short.
  +errors.integer={0} must be an integer.
  +errors.long={0} must be an long.
  +errors.float={0} must be an float.
  +errors.double={0} must be an double.
  +errors.date={0} is not a date.
  +errors.range={0} is not in the range {1} through {2}.
  +errors.creditcard={0} is not a valid credit card number.
  +errors.email={0} is an invalid e-mail address.
  
  
  
  1.20      +11 -5     jakarta-struts/web/example/logon.jsp
  
  Index: logon.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/logon.jsp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- logon.jsp	6 Jul 2002 23:36:30 -0000	1.19
  +++ logon.jsp	14 Jul 2002 01:35:18 -0000	1.20
  @@ -11,24 +11,25 @@
   
   <html:errors/>
   
  -<html:form action="/logon" focus="username">
  +<html:form action="/logon" focus="username"
  +         onsubmit="return validateLogonForm(this);">
   <table border="0" width="100%">
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.username"/>
  +      <bean:message key="prompt.username"/>:
       </th>
       <td align="left">
  -      <html:text property="username" size="16" maxlength="16"/>
  +      <html:text property="username" size="16" maxlength="18"/>
       </td>
     </tr>
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.password"/>
  +      <bean:message key="prompt.password"/>:
       </th>
       <td align="left">
  -      <html:password property="password" size="16" maxlength="16"
  +      <html:password property="password" size="16" maxlength="18"
                       redisplay="false"/>
       </td>
     </tr>
  @@ -45,6 +46,11 @@
   </table>
   
   </html:form>
  +
  +<html:javascript formName="logonForm"
  +        dynamicJavascript="true"
  +         staticJavascript="false"/>
  +<script language="Javascript1.1" src="staticJavascript.jsp"/>
   
   </body>
   </html:html>
  
  
  
  1.22      +6 -6      jakarta-struts/web/example/registration.jsp
  
  Index: registration.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/registration.jsp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- registration.jsp	17 Mar 2002 01:44:42 -0000	1.21
  +++ registration.jsp	14 Jul 2002 01:35:18 -0000	1.22
  @@ -30,7 +30,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.username"/>
  +      <bean:message key="prompt.username"/>:
       </th>
       <td align="left">
         <logic:equal name="registrationForm" property="action"
  @@ -50,7 +50,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.password"/>
  +      <bean:message key="prompt.password"/>:
       </th>
       <td align="left">
         <html:password property="password" size="16" maxlength="16"/>
  @@ -59,7 +59,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.password2"/>
  +      <bean:message key="prompt.password2"/>:
       </th>
       <td align="left">
         <html:password property="password2" size="16" maxlength="16"/>
  @@ -68,7 +68,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.fullName"/>
  +      <bean:message key="prompt.fullName"/>:
       </th>
       <td align="left">
         <html:text property="fullName" size="50"/>
  @@ -77,7 +77,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.fromAddress"/>
  +      <bean:message key="prompt.fromAddress"/>:
       </th>
       <td align="left">
         <html:text property="fromAddress" size="50"/>
  @@ -86,7 +86,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.replyToAddress"/>
  +      <bean:message key="prompt.replyToAddress"/>:
       </th>
       <td align="left">
         <html:text property="replyToAddress" size="50"/>
  
  
  
  1.29      +6 -6      jakarta-struts/web/example/subscription.jsp
  
  Index: subscription.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/subscription.jsp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- subscription.jsp	17 Mar 2002 01:44:42 -0000	1.28
  +++ subscription.jsp	14 Jul 2002 01:35:18 -0000	1.29
  @@ -39,7 +39,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.username"/>
  +      <bean:message key="prompt.username"/>:
       </th>
       <td align="left">
           <bean:write name="user" property="username" filter="true"/>
  @@ -48,7 +48,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.mailHostname"/>
  +      <bean:message key="prompt.mailHostname"/>:
       </th>
       <td align="left">
         <logic:equal name="subscriptionForm" property="action"
  @@ -64,7 +64,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.mailUsername"/>
  +      <bean:message key="prompt.mailUsername"/>:
       </th>
       <td align="left">
         <html:text property="username" size="50"/>
  @@ -73,7 +73,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.mailPassword"/>
  +      <bean:message key="prompt.mailPassword"/>:
       </th>
       <td align="left">
         <html:password property="password" size="50"/>
  @@ -82,7 +82,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.mailServerType"/>
  +      <bean:message key="prompt.mailServerType"/>:
       </th>
       <td align="left">
         <html:select property="type">
  @@ -94,7 +94,7 @@
   
     <tr>
       <th align="right">
  -      <bean:message key="prompt.autoConnect"/>
  +      <bean:message key="prompt.autoConnect"/>:
       </th>
       <td align="left">
         <html:checkbox property="autoConnect"/>
  
  
  
  1.1                  jakarta-struts/web/example/staticJavascript.jsp
  
  Index: staticJavascript.jsp
  ===================================================================
  <%@ page language="java" %>
  <%-- set document type to Javascript (addresses a bug in Netscape according to a web
resource --%>
  <%@ page contentType="application/x-javascript" %>
  
  <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
  
  <html:javascript dynamicJavascript="false" staticJavascript="true"/>
  
  
  
  1.24      +10 -0     jakarta-struts/web/example/WEB-INF/struts-config.xml
  
  Index: struts-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/WEB-INF/struts-config.xml,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- struts-config.xml	5 Jul 2002 22:09:21 -0000	1.23
  +++ struts-config.xml	14 Jul 2002 01:35:18 -0000	1.24
  @@ -50,8 +50,12 @@
       <form-bean      name="logonForm"
                       type="org.apache.struts.webapp.example.LogonForm"/>
   -->
  +<!--
       <form-bean      name="logonForm"
                       type="org.apache.struts.action.DynaActionForm">
  +-->
  +    <form-bean      name="logonForm"
  +                    type="org.apache.struts.validator.DynaValidatorForm">
         <form-property name="username" type="java.lang.String"/>
         <form-property name="password" type="java.lang.String"/>
       </form-bean>
  @@ -162,6 +166,12 @@
   
     <plug-in className="org.apache.struts.webapp.example.memory.MemoryDatabasePlugIn">
       <set-property property="pathname" value="/WEB-INF/database.xml"/>
  +  </plug-in>
  +
  +  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
  +    <set-property property="pathnames"
  +                     value="/WEB-INF/validator-rules.xml,
  +                            /WEB-INF/validation.xml"/>
     </plug-in>
   
   
  
  
  
  1.1                  jakarta-struts/web/example/WEB-INF/validation.xml
  
  Index: validation.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" ?>
  
  <!--
      Validation Rules for the Struts Example Web Application
  
      $Id: validation.xml,v 1.1 2002/07/14 01:35:18 craigmcc Exp $
  -->
  
  <form-validation>
  
  
      <!-- ========== Default Language Form Definitions ===================== -->
      <formset>
  
          <form name="logonForm">
  
              <field property="username"
                      depends="minlength,maxlength">
                  <arg0   key="prompt.username"/>
                  <arg1   key="${var:minlength}" name="minlength"
                     resource="false"/>
                  <arg2   key="${var:maxlength}" name="maxlength"
                     resource="false"/>
                  <var>
                      <var-name>maxlength</var-name>
                      <var-value>16</var-value>
                  </var>
                  <var>
                      <var-name>minlength</var-name>
                      <var-value>3</var-value>
                  </var>
              </field>
  
              <field property="password">
                  <arg0   key="prompt.username"/>
                  <arg1   key="${var:minlength}" name="minlength"
                     resource="false"/>
                  <arg2   key="${var:maxlength}" name="maxlength"
                     resource="false"/>
                  <var>
                      <var-name>maxlength</var-name>
                      <var-value>16</var-value>
                  </var>
                  <var>
                      <var-name>minlength</var-name>
                      <var-value>3</var-value>
                  </var>
              </field>
  
          </form>
  
  
      </formset>
  
  
  </form-validation>
  
  
  

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message