Can anyone help? I am trying to use the validation with Struts 1.0 and I get this 
message 

javax.servlet.jsp.JspException: Can't get definitions factory from context.

        s1.struts.taglib.component.InsertTag$TagHandler 
s1.struts.taglib.component.InsertTag.processDefinitionName(java.lang.String)

        s1.struts.taglib.component.InsertTag$TagHandler 
s1.struts.taglib.component.InsertTag.createTagHandler()

        int s1.struts.taglib.component.InsertTag.doStartTag()

when I try to add the following to my web.xml:
  <!-- Validator Initialization Servlet Configuration -->
  <servlet>
    <servlet-name>validator</servlet-name>
    <servlet-class>com.wintecinc.struts.action.ValidatorServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/validation.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>1</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>

 -----Original Message-----
From:   Parmar, Dipakkumar [mailto:[EMAIL PROTECTED]] 
Sent:   Friday, April 19, 2002 3:06 PM
To:     Struts Users Mailing List
Subject:        RE: Validator help

I don't think so i need to initialize the validator in the web.xml file if i
use 1.1b1.
I did plug In Configuration for validator in my struts-config.xml. Please
see my original message.

Deepak

-----Original Message-----
From: Honman Lee [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 19, 2002 5:58 PM
To: Struts Users Mailing List
Subject: RE: Validator help


I am having issues with my validation too.  Did you initialize the validator
in the web.xml file?

-----Original Message-----
From: Parmar, Dipakkumar [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 19, 2002 2:48 PM
To: Struts Users Mailing List
Subject: Validator help


Hi,

I'm having really hard time to figure out why the validator is not working.
Here is the summary what i did:

1. I tried to produce debug/error messages for org.apache.commons.validator
but no luck.
        (see thread "How can i turn on debug for org.apache.commons.validator")

2. I override validate method in my ActionForm and put the same code from
validate method in validate.java(org.apache.commons.validator). I found out
that my validation.xml file is not initialize. I don't know why. I follow
validator sample come with struts. I'm using 1.1b1.

here is all required info if any one interested helping me out.

// CRTypeForm.java
public class CRTypeForm extends ValidatorForm {

    // CR Type name
    private String crTypeName;

    public String getCrTypeName() {
        logger.debug("CRTypeForm:getCrTypeName" + crTypeName);
        return crTypeName;
    }

    public void setCrTypeName(String crTypeName) {
        logger.debug("CRTypeForm:setCrTypeName" + crTypeName);
        this.crTypeName = crTypeName;
    }
}


// struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>


<struts-config>

  <!-- ========== Form Bean Definitions
=================================== -->
  <form-beans>

    <!-- CR Type form bean -->
    <form-bean      name="CRTypeForm"
                    type="com.cgmp.esm.web.crtype.CRTypeForm"/>

  </form-beans>


  <!-- ========== Action Mapping Definitions
============================== -->
  <action-mappings>

    <!-- Save CR Type-->
    <action    path="/saveCrType"
               type="com.cgmp.esm.web.crtype.SaveCrTypeAction"
               name="CRTypeForm"
               scope="request"
               validate="true"
               input="/crtype.jsp">
       <forward name="success"              path="/success.jsp"/>
    </action>

  </action-mappings>

  <!-- ========== Message Resources Definitions
=========================== -->

  <message-resources
    parameter="com.cgmp.esm.web.ApplicationResources"/>

  <!-- ========== Plug Ins Configuration
================================== -->

  <!-- Add multiple validator resource files by setting the pathname
property -->
  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathname" value="/WEB-INF/validation.xml"/>
  </plug-in>

</struts-config>

# Validation.xml file
<form-validation>
   <formset>
      <form    name="CRTypeForm">
         <field    property="crTypeName"
                   depends="required, maxlength">
                     <arg0 key="prompt.crtypename"/>
                     <arg1 name="maxlength" key="${var:minlength}"
resource="false"/>
                     <var>
                       <var-name>maxlength</var-name>
                       <var-value>50</var-value>
                     </var>
         </field>
      </form>
   </formset>
</form-validation>

regards,
Deepak


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


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


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




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

Reply via email to