I see nothing wrong - the actions look fine and #errorMarkup() should take
care of displaying any form errors.  Did you model this after the validator
example in the velstruts appliction that comes with Velocity Tools 1.1-rc1?

cheers,
Marin�

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm fairly new to Struts, and have been trying to get my simple
> application to work - using Struts 1.1, Velocity 1.3.1, Velocity
> Tools 1.1-rc1, and Tomcat 4.1.29. The application (such as it is)
> works as far as presentation and workflow - but _isn't_ working is
> the Validator framework. I've spent the last day mining the web for
> help and haven't been able to progress at all...
>
> The validator files _are_ being loaded - I see them in the log
> files. And the rules/formset are being parsed - again, I see it in
> the log. However, when the form is submitted on the first page
> (payment.vm) and it goes to the second...no validation takes place.
> No errors are appearing in either the catalina.out or localhost
> log file. I have kicked up the log level to trace and still see
> nothing wrong - other than the validation doesn't seem to happen.
>
> Any help or suggestions would be GREATLY appreciated - I'm rather
> stuck at the moment. I'm sure its just some silly configuration
> or other error...
>
> I'm including all the relevant files inline below.
>
> Thank you very much
>
>   Andy Akins
>
> ====== web.xml
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>
> <web-app>
>   <display-name>CCPAY</display-name>
>   <servlet>
>     <servlet-name>action</servlet-name>
>     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>     <init-param>
>       <param-name>config</param-name>
>       <param-value>/WEB-INF/struts-config.xml</param-value>
>     </init-param>
>     <init-param>
>       <param-name>debug</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <init-param>
>       <param-name>detail</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <init-param>
>       <param-name>validate</param-name>
>       <param-value>true</param-value>
>     </init-param>
>     <load-on-startup>2</load-on-startup>
>   </servlet>
>   <servlet>
>     <servlet-name>velocity</servlet-name>
>
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</s
ervlet-class>
>     <init-param>
>       <param-name>org.apache.velocity.toolbox</param-name>
>       <param-value>/WEB-INF/toolbox.xml</param-value>
>     </init-param>
>     <init-param>
>       <param-name>org.apache.velocity.properties</param-name>
>       <param-value>/WEB-INF/velocity.properties</param-value>
>    </init-param>
>    <load-on-startup>10</load-on-startup>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>action</servlet-name>
>     <url-pattern>*.do</url-pattern>
>   </servlet-mapping>
>   <servlet-mapping>
>     <servlet-name>velocity</servlet-name>
>     <url-pattern>*.vm</url-pattern>
>   </servlet-mapping>
>   <welcome-file-list>
>     <welcome-file>index.html</welcome-file>
>   </welcome-file-list>
> </web-app>
>
> ===== struts-config.xml
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <!DOCTYPE struts-config PUBLIC
>           "-//Apache Software Foundation//DTD Struts Configuration
1.1//EN"
>           "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>
> <struts-config>
>   <form-beans>
>     <form-bean name="paymentForm"
type="org.apache.struts.validator.DynaValidatorForm">
>       <form-property name="amount" type="java.lang.String" initial="boo"
/>
>     </form-bean>
>   </form-beans>
>   <action-mappings>
>     <action path="/Payment"
>       type="org.apache.struts.actions.ForwardAction"
>       name="paymentForm"
>       validate="false"
>       parameter="/payment.vm"/>
>     <action path="/Processing"
>       type="org.apache.struts.actions.ForwardAction"
>       name="paymentForm"
>       input="/Payment.do"
>       validate="true"
>       parameter="/processing.vm"/>
>   </action-mappings>
>   <message-resources parameter="application" />
>   <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
>     <set-property property="pathnames"
>       value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>   </plug-in>
> </struts-config>
>
> ===== validation.xml - I'm using the standard validate-rules.xml
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <!DOCTYPE form-validation PUBLIC
>   "-//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.0//EN"
>   "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd";>
> <form-validation>
>   <formset>
>     <form name="paymentForm">
>       <field property="amount"
>         depends="required,email">
>         <msg name="email" key="errors.invalid"/>
>         <arg0 key="paymentForm.label.amount" />
>       </field>
>     </form>
>   </formset>
> </form-validation>
>
> ===== Toolbox.xml
> <?xml version="1.0"?>
>
> <toolbox>
>   <tool>
>      <key>link</key>
>      <class>org.apache.velocity.tools.struts.StrutsLinkTool</class>
>   </tool>
>   <tool>
>      <key>slink</key>
>      <class>org.apache.velocity.tools.struts.SecureLinkTool</class>
>   </tool>
>   <tool>
>      <key>text</key>
>      <class>org.apache.velocity.tools.struts.MessageTool</class>
>   </tool>
>   <tool>
>      <key>errors</key>
>      <class>org.apache.velocity.tools.struts.ErrorsTool</class>
>   </tool>
>   <tool>
>      <key>messages</key>
>      <class>org.apache.velocity.tools.struts.ActionMessagesTool</class>
>   </tool>
>   <tool>
>      <key>form</key>
>      <class>org.apache.velocity.tools.struts.FormTool</class>
>   </tool>
>   <tool>
>      <key>tiles</key>
>      <class>org.apache.velocity.tools.struts.TilesTool</class>
>   </tool>
>   <tool>
>      <key>validator</key>
>      <class>org.apache.velocity.tools.struts.ValidatorTool</class>
>   </tool>
> </toolbox>
>
> ===== payment.vm
> <html lang="en-US">
>   <head>
>     <title>CCPAY</title>
>     <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
>     <meta name="robots" content="noindex,nofollow">
>     <link rel="stylesheet" type="text/css"
href="/ccpay/pages/css/tccles.css">
>   </head>
>   <body class="body">
>   #errorMarkup()
>     <form action="$link.setAction('Processing')" method="post">
>       <table border="0" cellpadding="2" cellspacing="4" align="center"
summary="Credit Card Information" width="100%">
>         <tr>
>           <td class="head">Fee to be billed to your card</td>
>           <td> $
>             <input type="text" size="15" name="amount"
value="$!paymentForm.amount" >
>           </td>
>         </tr>
>       </table>
>       <input type="submit" name="submit" />
>     </form>
>   </body>
> </html>
>
> ===== processing.vm
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html lang="en-US">
>   <head>
>     <title>Processing Page.</title>
>     <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
>     <meta name="robots" content="noindex,nofollow">
>     <link rel="stylesheet" type="text/css"
href="/ccpay/pages/css/tccles.css">
>   </head>
>   <body class="body">
>     <div align="center"> <img src="/ccpay/pages/images/header.gif"
alt="State of Tennessee Payment Option.">
>     </div>
>     <div align="center"><br>
>       <h4>Processing ...<br>
>         Thank you for your patience<br>
>         $!paymentForm.amount<br>
>         <img
src="https://www.tennesseeanytime.org/tnanytime/apps/processing.gif";
alt="Showing Progress."></h4>
>     </div>
>   </body>
> </html>
>
> ===== VM_global_library.vm
> ## Display all queued Struts errors
> #macro (errorMarkup)
>     #if ($errors.exist() )
>         <ul>
>         #foreach ($e in $errors.all )
>             $e
>         #end
>         </ul>
>     #end
> #end




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to