HTH,
Matt
On Jan 13, 2004, at 10:56 PM, VENKATESH GANGAL wrote:
Hi All,
We have been facing a very strange problem with form validation
We have a JSP which is an input to an action and there is an associated form bean to validate the form.
Here is the configuaration file struts-config.xml: <form-beans> <form-bean name="summaryForm" type="com.xxx.yyy.zzz.core.view.SummaryForm">
</form-bean> </form-beans>
<action path="/summaryEdit" type="com.xxx.yyy.zzz.core.controller.SummaryAction" name="summaryForm" scope="session" validate="true" input="/casefolder-jsp/summaryEdit.jsp"> <forward name="workflowEdit" path="/casefolder- jsp/workflowEdit.jsp"/> </action>
<message-resources parameter="MessageResources"/>
<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="summaryEditForm"> <field property="productRef" depends="required"> <arg0 key="form.error.productRef"/> </field> </form> </formset>
</form-validation>
MessageResources.properties form.error.productRef = Please enter Product Reference
FormBean Validation method :
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request)
{
//ActionErrors errors = super.validate(mapping, request);
ActionErrors errors = new ActionErrors();
if ((productRef == null) || (productRef.trim().length()< 1)){
errors.add ("productRef",new ActionError("form.error.productRef"));
}
return errors ;
}
Here is the JSP
<html:html locale="true">
<head><html:base />
</head> <body>
<html:form action="summaryEdit">
<table>
</tr>
<tr> <td><html:errors /></td>
</tr>
<tr>
<td class="searchCtrlL"><html:text property="productRef" ></td>
</tr>
When I submit this form without entering anything in the textfield, it is taking me to a blank page.
Can anyone let me know why this is happening? It is not going to the action at all and is returning with errors to the JSP.I am not able to reach the page from where I submitted the data along with errors.The error was added to ActionErrors object.
We are using oc4j(Oracle Apps) standalone application.We are using struts 1.1
Thanks in advance for your help.
Cheers... Venkatesh
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]