reguser.jsp(唯一的jsp文件):
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/Struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/Struts-html.tld" prefix="html" %>
<html:html locale="true">
<head>
<title>RegUser</title>
<html:base/>
</head>
<body bgcolor="white">
<html:errors/>
<html:form action="/regUserAction" focus="logname">
<table border="0" width="100%">
  <tr>
    <th align="right">
      Logname:
    </th>
    <td align="left">
      <html:text property="logname" size="20" maxlength="20"/>
    </td>
  </tr>
  <tr>
    <th align="right">
      Password:
    </th>
    <td align="left">
      <html:password property="password" size="20" maxlength="20"/>
    </td>
  </tr> 
  <tr>
    <th align="right">
      E-mail:
    </th>
    <td align="left">
      <html:text property="email" size="30" maxlength="50"/>
    </td>
  </tr>
  <tr>
    <td align="right">
      <html:submit property="submit" value="Submit"/>
    </td>
    <td align="left">
      <html:reset/>
    </td>
  </tr>
</table>
</html:form>
</body>
</html:html>

解决方案 »

  1.   

    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"><!--
         This is the Struts configuration file for the example application,
         using the proposed new syntax.
    -->
    <struts-config>
    <form-beans>
    <form-bean name="regUserForm" type="org.cjea.Struts.example.RegUserForm"/>
    </form-beans><action-mappings>
    <action  path="/regUserAction"
            type="org.cjea.Struts.example.RegUserAction"
            attribute="regUserForm"
            scope="request"
            validate="false">
          <forward name="failure"   path="/messageFailure.jsp"/>
          <forward name="success"  path="/messageSuccess.jsp"/>
    </action>
    </action-mappings>
    </struts-config>
      

  2.   

    RegUserForm.java:
    package org.cjea.Struts.example;import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;public final class RegUserForm extends ActionForm{  private String logname="";
      private String password="";
      private String email="";  public RegUserForm(){
        logname = null;
        password = null;
        email = null;
      }  public String getLogName() {
        return this.logname;
      }
      public void setLogName(String logname) {
        this.logname = logname;
      }
      public void setPassWord(String password) {
        this.password = password;
      }
      public String getPassWord() {
        return this.password;
      }
      public void setEmail(String email) {
        this.email = email;
      }
      public String getEmail() {
        return this.email;
      }  public void reset(ActionMapping mapping, HttpServletRequest request)
        {
            logname = null;
    password = null;
    email = null;
        }
    }
      

  3.   

    对应ActionForm的Action类在哪里??你用的是struts1 .0吗??现在都1.1了。struts-config.xml都不一样。
      

  4.   

    检查一下你的action类,这个提示就是告诉你你的form bean 里没有东西
      

  5.   

    <form-beans>
    <form-bean name="regUserForm" type="org.cjea.Struts.example.RegUserForm"/>
    </form-beans>
    不是空啊,有东西的
      

  6.   

    <action  path="/regUserAction"
            type="org.cjea.Struts.example.RegUserAction"
            attribute="regUserForm"
            scope="request"
            validate="false">
          <forward name="failure"   path="/messageFailure.jsp"/>
          <forward name="success"  path="/messageSuccess.jsp"/>
    </action>
    我把这里的attribute改成name则出现下列错误提示;No getter method for property logname of bean org.apache.struts.taglib.html.BEAN
    这是怎么回事,事事上getter方法已经有了
      

  7.   

    <html:form action="/regUserAction" focus="logname">
    先改成
    <html:form action="/regUserAction.do" focus="logname">
    再说
      

  8.   

    you haven't given a "name" attribute for action tag.
    <action  path="/regUserAction"
            name="regUserForm"//if you haven't asigned this one,system will find null
    type="org.cjea.Struts.example.RegUserAction"
            attribute="regUserForm"
            scope="request"
            validate="false">
          <forward name="failure"   path="/messageFailure.jsp"/>
          <forward name="success"  path="/messageSuccess.jsp"/>
    </action>
      

  9.   

    可是加了以后出现这样的提示;No getter method for property logname of bean org.apache.struts.taglib.html.BEAN
    怎么回事
      

  10.   

    public String getLogName() {
        return this.logname;
      }
      public void setLogName(String logname) {
        this.logname = logname;
      }
    中所有Name改为name,也就是说N小写
      

  11.   

    对了,只有第一个字母可以大写(当然是除掉了set和get之后),这好像是很多apache的web framework的一个共同的限制
      

  12.   

    只有第一个字母可以大写,这种说法不准确。
    1、所有的属性必须以小写字母开始
    2、Set和Get函数将属性的第一个字母改为大写
    在本例中,因为属性全是小写,所以Set只能第一个字母是大写。
    如果定义属性为passWord,则Set函数为setPassWord(),Get函数为getPassWord()