代码没错啊.把XML文件贴上来看看.

解决方案 »

  1.   

    <?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 />
      <form-beans >
        <form-bean name="userLoginForm" type="com.yourcompany.struts.form.UserLoginForm" />  </form-beans>  <global-exceptions />
      <global-forwards />
      <action-mappings >
        <action
          attribute="userLoginForm"
          input="/userLogin.jsp"
          name="userLoginForm"
          path="/userLogin"
          scope="request"
          type="com.yourcompany.struts.action.UserLoginAction"
          validate="true">
          <forward name="faile" path="/userLogin.jsp" />
        </action>
      </action-mappings>
      <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
    </struts-config>
      

  2.   

    <%@ page language="java" pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> 
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
     
    <html> 
    <head>
    <title>JSP for UserLoginForm form</title>
    </head>
    <body>
    <br/>
    <html:errors/>
    <center>
    <html:form action="/userLogin"> 
    userName : <html:text property="userName" size="10"></html:text>
    <logic:present name="error" scope="request">
    <h2>
    <bean:write name="error" scope="request"/><p>
    </h2>
    </logic:present>
    <html:errors/>    ×这里无法显示,页面报错
    <input type="button" onClick="javascript:aa()" value="tj"/>
    <html:reset/>
    </html:form>
    </center>
    </body>
    <script language="javascript">
    function aa()
    {
    userLoginForm.submit();
    }
    </script>
    </html>
      

  3.   

    userName == null || userName.length() < 1:
    userName == null && userName.length() < 1
      

  4.   

    userName.length() ,userName为null,不能执行userName.length()
      

  5.   

    在登陆页只写一个FORM.其他的不要.还是没看出有什么错误.
    资源文件没问题吧.