Hi,
Name of form into validation.xml is the path of your Action
and not the name of your Action :

<form name="/Control">
  <field property="strFirstName" depends="required">
    <arg0 key="privacyPrefForm.strFirstName"/>
  </field>
</form>


Declare in your AplicationResources
(see example into validator-rules.xml)

errors.required={0} is required.
privacyPrefForm.strFirstName=First name

Regards
Angelo


2006/1/29, Karthik Manimaran <[EMAIL PROTECTED]>:
>
> This is the form definition
>   <form-bean name="privacyPrefForm" type="
> com.bofa.ecomm.snf.web.privacy.PrivacyPreferencesBean">
>   </form-bean>
>
> The JSP file is as follows:
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
>
> <html:form action = "Control.do?body=privacysecur_set_privacy_pref"
> method="post">
>
> <logic:notPresent name="org.apache.struts.action.ERROR">
> Errors Not Present
> </logic:notPresent>
>
> <html:errors/>
>    <html:text property="strFirstName" size="30" maxlength="30"
> styleId="strFirstName"/>
> </html:form>
>
>
> On 1/29/06, Richard Yee <[EMAIL PROTECTED]> wrote:
> >
> > What is the form definition for privacyPrefForm? Where is the tag for
> > your strFirstName field in your form?
> >
> > Are you using a debugger at all?
> >
> > -Richard
> >
> >
> > Karthik Manimaran wrote:
> > > Hi,
> > >
> > > I am using the validator framework for form validation. Validation
> > doesnt
> > > seem to happen and no error messages are displayed. However the form
> is
> > > getting pre-populated with the user input. Can anyone tell me what I
> am
> > > missing here?
> > >
> > > struts-config.xml
> > > -------------------------
> > >   <action path="/Control" type="com.bofa.ecomm.snf.web.global.Control"
> > > name="privacyPrefForm" scope="request" validate="true">
> > >    <forward name="success" path="/jsp/global/def.jsp"/>
> > >    <forward name="failure" path="/jsp/global/selectstate.jsp"/>
> > >   </action>
> > > ...
> > >  <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
> > > ---------------------
> > > <?xml version="1.0" encoding="ISO-8859-1" ?>
> > >
> > > <!DOCTYPE form-validation PUBLIC
> > >           "-//Apache Software Foundation//DTD Commons Validator Rules
> > > Configuration 1.1.3//EN"
> > >           "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd
> ">
> > >
> > > <form-validation>
> > >     <formset>
> > >         <form name="privacyPrefForm">
> > >             <field property="strFirstName"
> > >                 depends="required">
> > >                 <arg0 key="errors.required"/>
> > >             </field>
> > >         </form>
> > >     </formset>
> > > </form-validation>
> > >
> > > JSP file:
> > > -----------
> > >
> > > <%@ page language="java" %>
> > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> > >
> > > <html:form action = "Control.do?body=privacysecur_set_privacy_pref"
> > > method="post">
> > > <html:errors/>
> > > ....
> > >
> > > </html:form>
> > >
> > > I am using the validator-rules.xml that comes with struts
> distribution.
> > >
> > > Thanks and regards,
> > > Karthik
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>

Reply via email to