你可以檢查你的struts-config的部件是否齊全,如<data-sources>....<form-beans>...

解决方案 »

  1.   

    控制台打印的信息呢?贴出来,
    看看"/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml
    这两个xml文件的语法有没有错误,validator的jar 包有没有加进去
    另:
    <data-sources>不是必须的,因为一般的项目是有专门的DAO层,并不是由struts管理的
      

  2.   

    这是struts-config.xml源文件:
    <?xml version="1.0" encoding="UTF-8"?>
    <!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>
    <data-sources></data-sources>
    <form-beans>
    <form-bean name="UserInfo" type="Form.HelloForm">
    <form-property name="userName" type="java.lang.String"></form-property>
    </form-bean>
    <form-bean name="registerForm" type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="username" type="java.lang.String"></form-property>
    <form-property name="phone" type="java.lang.String"></form-property>
    <form-property name="zip" type="java.lang.String"></form-property>
    <form-property name="age" type="java.lang.String"></form-property>
    <form-property name="email" type="java.lang.String"></form-property>
    </form-bean>
    </form-beans>
    <global-exceptions></global-exceptions>
    <global-forwards></global-forwards>
    <action-mappings>
    <action 
    path="/HelloWorld"
    type="Action.HelloAction"
    name="UserInfo"
    scope="request"
    validate="false"
    input="/page/hello.jsp">
    <forward name="success" path="/page/hello.jsp"></forward>
    </action>

    <action
     path="/regaction"
     type="Action.RegisterAction"
     name="registerForm"
     scope="session"
     validate="true"
     input="/page/register.jsp">
     <forward name="success" path="/page/success.jsp"></forward>
     </action>
    </action-mappings>
    <controller contentType="text/html;charset=gb2312"
    locale="true">
    </controller>
    <message-resources parameter="app.application"></message-resources>
    <message-resources parameter="app.applicationregister"></message-resources>

    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">         <set-property   property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
              </plug-in></struts-config>
    所有的包都加进去了的.
      

  3.   


    出现了以下的严重错误
    严重: Servlet /TEST threw load() exception
    javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'严重: The element type "form-validation" must be terminated by the matching end-tag "</form-validation>".
    javax.servlet.ServletException: The element type "form-validation" must be terminated by the matching end-tag "</form-validation>".
    但是都有</form-validation>严重: Parse error in application web.xml
    java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name action
      

  4.   

    严重: The element type "form-validation" must be terminated by the matching end-tag "</form-validation>".
    javax.servlet.ServletException: The element type "form-validation" must be terminated by the matching end-tag "</form-validation>".
    ---------------------
    你把这两个xml文件用QQ传给我吧,贴出来太难看,但是我保证是这里面的问题
    我的QQ:8781835