Laurie,

Thanks for getting back to me.

I've been able to get a little further. I've gotten the jsp to come up.
When I click the submit button with nothing in either input field it stops
on a breakpoint in the validate method of the DynaValidatorForm class.
Just in case you don't have the code of that class in front of you : )
here's the method I'm talking about
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
        this.setPageFromDynaProperty();
        ServletContext application = getServlet().getServletContext();
        ActionErrors errors = new ActionErrors();
        String validationKey = getValidationKey(mapping, request);
        Validator validator = Resources.initValidator(validationKey,this
,application, request,errors, page);
        try {
            validatorResults = validator.validate();
        } catch (ValidatorException e) {
            log.error(e.getMessage(), e);
        }
        return errors;
    }

It creates the validationKey variable fine. When I inspect it I see that
the value of it is the name I specified for the form-bean in my
struts-config.xml file.

It also creates the validator variable fine.When I inspect it I see that
the formName variable is correct and the resources.hFormSets variable has
the info about my form and the field that is required.

However, when it executes the validator.validate() method it goes to the
catch block. If I try to inspect the ValidatorException variable I get a "e
cannot be resolved" error message. This could be just a quirk of the SAP
IDE but I'm kind of lost why it would fail there.

So now I have two questions:
1)  What do I need to to see the output of fthe log.error(e.getMessage())
statement in the catch block?
2)  Could someone review my modified xml and jsp files (see below) and see
if there is anything obviously wrong?

Thanks in advance for any help

***STRUTS-CONFIG.XML
<struts-config>
<form-beans>
 <form-bean name="dynaForm"
    type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="customer" type="java.lang.String"/>
      <form-property name="email" type="java.lang.String"/>
  </form-bean>
</form-beans>
<global-forwards>
      <forward
            name="/thankYou"
            path="/thankyou.html"
            redirect="true" />
</global-forwards>
<action-mappings>
  <action path="/dynaTest" type="com.firstenergycorp.dzp.DynaTester"
    name="dynaForm"
    scope="request"
    input="/dyna.jsp">
    validate="true"
    <forward name="/success" path="/thank_you.html"/>
  </action>
</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/validator.xml"/>
</plug-in>
</struts-config>

***WEB.XML
<web-app>
    <display-name>WEB APP</display-name>
    <description>WEB APP description</description>
     <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet
</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
     <servlet>
        <servlet-name>dyna.jsp</servlet-name>
        <jsp-file>/dyna.jsp</jsp-file>
    </servlet>
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <taglib>
        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
    </taglib>
</web-app>

***VALIDATOR.XML
<form-validation>
<formset>
<form name="dynaForm">
  <field property="customer" depends="required">
    <arg0 key="customer" resource="false"/>
  </field>
</form>
</formset>
</form-validation>

***DYNA.JSP
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
<body>
<html:form action = "/dynaTest">
Customer Name:*<html:text property="customer" />
<logic:messagesPresent property="customer">
<font color = "red">
  <html:messages property="customer" id="error">
    <bean:write name="error"/>
  </html:messages>
</font>
</logic:messagesPresent>
<br><br>
email:<html:text property="email" /><br><br>
<html:submit>Submit</html:submit>
</html:form>
</body>
</html>





                                                                           
             Laurie Harper                                                 
             <[EMAIL PROTECTED]                                             
             et>                                                        To 
             Sent by: news             user@struts.apache.org              
             <[EMAIL PROTECTED]                                          cc 
             rg>                                                           
                                                                   Subject 
                                       Re: Looking for a tutorial or       
             04/09/2006 09:46          complete example of using           
             PM                        DynaValidatorForm                   
                                                                           
                                                                           
             Please respond to                                             
               "Struts Users                                               
               Mailing List"                                               
             <[EMAIL PROTECTED]                                             
                  he.org>                                                  
                                                                           
                                                                           




I don't see anything obviously wrong there. It's not surprising that
your breakpoints aren't hit since the action would only be invoked when
the form rendered by the JSP gets submitted.

It might help if you post the full stack trace you're getting. Failing
that, I'd suggest simplifying things as much as possible and then adding
everything back a bit at a time to figure out exactly what's causing the
problem.

L.



-----------------------------------------
The information contained in this message is intended only for the
personal and confidential use of the recipient(s) named above. If
the reader of this message is not the intended recipient or an
agent responsible for delivering it to the intended recipient, you
are hereby notified that you have received this document in error
and that any review, dissemination, distribution, or copying of
this message is strictly prohibited. If you have received this
communication in error, please notify us immediately, and delete
the original message.


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

Reply via email to