Hi,

I think your problem is with the input attribute of your
action. This is where the page is forwarded to if there is
a validation error. You might need to qualify the page
location (add a '/') or as I usually do, point to the
action rather than the jsp (if an action loads the input
page, as it might have some processing that the page 
requires).


Paul

-----Original Message-----
From: LACKEY,DAVID (HP-PaloAlto,ex1) [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 23, 2003 9:40 PM
To: '[EMAIL PROTECTED]'
Subject: Struts & Validator question


All

I hope this is not a newbie question.  I have RTFM several times.  I suspect
I must be missing something simple.  I have installed Tomcat 4.1.29 and
Struts 1.1 with the Validator included.  I have configured my installation
as follows

struts-config.xml:
<form-bean      name="orgForm" 
        type="com.hp.ipg.ne.pgpm.forms.orgForm"/>
.
.
.
<!-- Insert a new Org into the database -->
<action path="/org_insert"
        name="orgForm"
        type="com.hp.ipg.ne.pgpm.actions.orgInsertAction"
        scope="request"
        validate="true" 
        input="org_edit.jsp" >
        <forward name="show_list" path="/org_list.do" />
        <forward name="error" path="/GeneralError.do" />
</action>
.
.
.
<message-resources parameter="com.hp.ipg.ne.pgpm.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>

Validation.xml:

<form-validation>
    <formset>
        <form name="orgForm">
              <field property="orgCode"
                        depends="required">
                <arg0 key="orgForm.OrgCode"/>
            </field>
        </form>
    </formset>
</form-validation>

Application:properties:
errors.required={0} is required.

In the org_edit.jsp file contains the following code snippet:
<logic:messagesPresent>
   <bean:message key="errors.header"/>
   <ul>
   <html:messages id="error">
      <li><bean:write name="error"/></li>
   </html:messages>
   </ul><hr>
</logic:messagesPresent>


I have stepped through the execution several times and see the validator
being activated.  I even see the failed validation (empty field).  However,
after the failed validation, it seems validator is unable to construct a
proper forward to send me back to the JSP page where the error was entered
(or not entered in this case).  I am simply forwarded to a nearly blank page
with minimal <html> and <body> tags.

Any thoughts would be appreciated.


David Lackey
[EMAIL PROTECTED]

 



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

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

Reply via email to