这是我的formbean
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.zwj.struts.Form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
* MyEclipse Struts
* Creation date: 06-12-2007
*
* XDoclet definition:
* @struts.form name="InsertForm"
*/
public class InsertForm extends ActionForm {
/*
* Generated fields
*/
/** address property */
private String address;
/** email property */
private String email;
/** name property */
private String name;
/** id property */
private String id;
/*
* Generated Methods
*/
/**
* Method validate
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (id == null || id.trim().length() == 0) {
ActionMessage message = new ActionMessage("error.id");
errors.add("nid", message);
}
if (name == null || name.trim().length() == 0) {
ActionMessage message = new ActionMessage("error.name");
errors.add("nname", message);
}
return errors;
}
/**
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}
/**
* Returns the address.
* @return String
*/
public String getAddress() {
return address;
}
/**
* Set the address.
* @param address The address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* Returns the email.
* @return String
*/
public String getEmail() {
return email;
}
/**
* Set the email.
* @param email The email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* Returns the name.
* @return String
*/
public String getName() {
return name;
}
/**
* Set the name.
* @param name The name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* Returns the id.
* @return String
*/
public String getId() {
return id;
}
/**
* Set the id.
* @param id The id to set
*/
public void setId(String id) {
this.id = id;
}
}
下面是我的sturts-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 />
<form-beans >
<form-bean name="InsertForm" type="com.zwj.struts.Form.InsertForm" />
</form-beans>
<global-exceptions />
<global-forwards >
<forward name="fail" path="/error.jsp" />
</global-forwards>
<action-mappings >
<action
attribute="InsertForm"
input="/insert.jsp"
name="InsertForm"
path="/insert"
scope="request"
type="com.zwj.struts.Action.InsertAction" >
<forward name="suc" path="/isuccess.jsp" />
</action>
</action-mappings>
<message-resources parameter="com.zwj.struts.Form.ApplicationResources" />
</struts-config>
我没有发现什么错误啊