login.jsp<%@ page language="java" pageEncoding="UTF-8"%><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
  <head>
    <html:base />
    
    <title>login.jsp</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->  </head>
  
  <body>
    <html:form action="/Login.do" method="post" focus="login" onsubmit="return validateloginForm(this);">
      <table border="0">
        <tr>
          <td>Login:</td>
          <td><html:text property="login" /></td>
        </tr>
        <tr>
          <td>Password:</td>
          <td><html:password property="password" /></td>
        </tr>
        <tr>
          <td colspan="2" align="center"><html:submit /></td>
        </tr>
      </table>
    </html:form>
    <html:javascript formName="loginForm" cdata="false" />
  </body>
</html:html>struct-config.xml片段  <form-beans >    <form-bean name="loginForm" type="org.apache.struts.validator.DynaValidatorActionForm">
      <form-property name="password" type="java.lang.String" />
      <form-property name="login" type="java.lang.String" />
    </form-bean>
      </form-beans>  <global-exceptions />
  <global-forwards >
  </global-forwards>  <action-mappings >    <action forward="/login.jsp" path="/LoginPage" />
    <action
      attribute="loginForm"
      input="/infoModel/login.jsp"
      name="loginForm"
      path="/Login"
      scope="request"
      type="com.base.struts.infomodel.LoginAction" />
    
validator.xml片段    <formset>      <form name="loginForm">
         <field property="login"
           depends="required">
            <arg0 key="prompt.login" />
           </field>
      </form>
  </action-mappings>验证没有执行,直接跳到action了

解决方案 »

  1.   

    return validateloginForm(this);
    好象要
    return validateLoginForm(this);
      

  2.   

    struts-config的bean是loginForm.有谁知道吗?
      

  3.   

    <html:form action="/Login.do" method="post" focus="login" onsubmit="return validateloginForm(this);">
    action="/Login.do" 有点问题,并没看到你做什么映射.
      

  4.   

    to daliyama() :
    action="/Login.do" 对应:
        <action
          attribute="loginForm"
          input="/infoModel/login.jsp"
          name="loginForm"
          path="/Login"
          scope="request"
          type="com.base.struts.infomodel.LoginAction" />
    直接执行LoginAction,但客户端的验证没有运行.computech_newRen(meizi) :
    能具体说吗
      

  5.   

    action="/Login.do"?????????没看到你的action啊???