You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "LACKEY,DAVID (HP-PaloAlto,ex1)" <da...@hp.com> on 2003/11/24 03:40:16 UTC

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
David.lackey2@hp.com

 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org