You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by MG...@globallink.com on 2006/03/06 17:19:30 UTC

Problem getting Validator plugin to work

I am having problem getting Validator plugin to work in a very simple case.
Here is the source code. Can some one tell me what I am doing wrong?

      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
            <set-property property="pathnames"

value="/WEB-INF/validator-rules.xml,/WEB-INF/validator.xml" />
      </plug-in>


    <form-bean name="SalesProspectForm"
type="com.globallink.glr.dataentryweb.form.AddSalesProspectForm">
            </form-bean>

            <action path="/AddSalesProspect"
type="com.globallink.glr.dataentryweb.action.AddSalesProspect"
name="SalesProspectForm" scope="request" validate="true"
input="/DisplayAddSalesProspect.do">
            </action>

public class AddSalesProspect extends Action
{
  public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
      HttpServletResponse response)
  {
    return null;
  }
}


public class AddSalesProspectForm extends ValidatorForm
{
  private String ClientFullName;

  public void setClientFullName(String clientFullName)
  {
    ClientFullName = clientFullName;
  }

  public String getClientFullName()
  {
    return ClientFullName;
  }
}


            <form name="AddSalesProspect">
                  <field property="clientFullName" depends="required">
                        <arg0 key="errors.required" />
                  </field>
            </form>


<%@ 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>
<HEAD>
<html:base />
<LINK rel="stylesheet"
      href="<%=request.getContextPath()%>/theme/global.css" type="text/css"
/>
<LINK rel="stylesheet"
      href="<%=request.getContextPath()%>/theme/grp.css" type="text/css" />
</HEAD>
<body>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
      <TBODY>
            <TR>
                  <td><html:errors /></td>
            </TR>
            <TR>
                  <td width="100%" align="center"><html:form action=
"AddSalesProspect">
                        <TABLE border="0">
                              <TBODY>
                                    <TR>
                                          <TD>Client Name</TD>
                                          <TD>Inst Id</TD>
                                          <TD>New/Exist</TD>
                                          <TD>Side</TD>
                                          <TD>Type</TD>
                                    </TR>
                                    <TR>
                                          <TD><html:text property=
"clientFullName" /></TD>
</tr>
                                    <TR>
                                          <td>&nbsp;</td>
                                    </TR>
                                          <TD><html:submit value="Save"
/></TD>
                                          <TD><html:reset value="Reset"
/></TD>
                                    </TR>
                              </TBODY>
                        </TABLE>
                  </html:form></td>
            </TR>
      </TBODY>
</TABLE>
</body>
</html>

--Mohan



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


Re: Problem getting Validator plugin to work

Posted by MG...@globallink.com.
That made it work.
Thanks,
Mohan




                                                                           
             "Hubert Rabago"                                               
             <hrabago@gmail.co                                             
             m>                                                         To 
                                       "Struts Users Mailing List"         
             03/06/2006 12:02          <us...@struts.apache.org>            
             PM                                                         cc 
                                                                           
                                                                   Subject 
             Please respond to         Re: Problem getting Validator       
               "Struts Users           plugin to work                      
               Mailing List"                                               
             <user@struts.apac                                             
                  he.org>                                                  
                                                                           
                                                                           
                                                                           




On 3/6/06, MGShenoy@globallink.com <MG...@globallink.com> wrote:
>
>     <form-bean name="SalesProspectForm"
> type="com.globallink.glr.dataentryweb.form.AddSalesProspectForm">

> public class AddSalesProspectForm extends ValidatorForm

>             <form name="AddSalesProspect">


Since you're extending ValidatorForm, Validator will try to find
validation rules based on the declared form name.
Try using
             <form name="SalesProspectForm">

in your validator.xml file.

Hubert

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




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


Re: Problem getting Validator plugin to work

Posted by Hubert Rabago <hr...@gmail.com>.
On 3/6/06, MGShenoy@globallink.com <MG...@globallink.com> wrote:
>
>     <form-bean name="SalesProspectForm"
> type="com.globallink.glr.dataentryweb.form.AddSalesProspectForm">

> public class AddSalesProspectForm extends ValidatorForm

>             <form name="AddSalesProspect">


Since you're extending ValidatorForm, Validator will try to find
validation rules based on the declared form name.
Try using
             <form name="SalesProspectForm">

in your validator.xml file.

Hubert

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


Re: Problem getting Validator plugin to work

Posted by Dave Newton <ne...@pingsite.com>.
MGShenoy@globallink.com wrote:
> I am having problem getting Validator plugin to work in a very simple case.
> Here is the source code. Can some one tell me what I am doing wrong?
>   


What are the symptoms? Normally it's good to provide information like that.

Dave



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