struts.config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
<data-sources />
<form-beans >
<form-bean name="personForm" type="com.hxl.ssh.struts.form.PersonForm" /> </form-beans> <global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="personForm"
input="/form/person.jsp"
name="personForm"
parameter="status"
path="/person"
scope="request"
type="org.springframework.web.struts.DelegatingRequestProcessor" /> </action-mappings> <message-resources parameter="com.hxl.ssh.struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml" />
</plug-in>
</struts-config>register.jsp代码
<%@ page language="java" pageEncoding="gbk"%><%@ 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>register.jsp </title> </head>
<body>
<center>
<form action="person.do" method="post">
用户名: <input type="text" name="name"> <br>
密 码: <input type="password" name="password"> <br>
<input type="hidden" name="status" value="insert">
<input type="submit" value="注册">
</form>
</center>
</body>
</html:html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
<data-sources />
<form-beans >
<form-bean name="personForm" type="com.hxl.ssh.struts.form.PersonForm" /> </form-beans> <global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="personForm"
input="/form/person.jsp"
name="personForm"
parameter="status"
path="/person"
scope="request"
type="org.springframework.web.struts.DelegatingRequestProcessor" /> </action-mappings> <message-resources parameter="com.hxl.ssh.struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml" />
</plug-in>
</struts-config>register.jsp代码
<%@ page language="java" pageEncoding="gbk"%><%@ 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>register.jsp </title> </head>
<body>
<center>
<form action="person.do" method="post">
用户名: <input type="text" name="name"> <br>
密 码: <input type="password" name="password"> <br>
<input type="hidden" name="status" value="insert">
<input type="submit" value="注册">
</form>
</center>
</body>
</html:html>
<action
attribute="personForm"
input="/form/person.jsp"
name="personForm"
parameter="status"
path="/person"
scope="request"
type="org.springframework.web.struts.DelegatingRequestProcessor" /> </action-mappings> 去掉这行
谢谢各位,小弟自己写错一个类,
<action-mappings >
<action
attribute="personForm"
input="/form/person.jsp"
name="personForm"
parameter="status"
path="/person"
scope="request"
type="org.springframework.web.struts.DelegatingRequestProcessor" /> </action-mappings>应为:<action-mappings >
<action
attribute="personForm"
input="/form/person.jsp"
name="personForm"
parameter="status"
path="/person"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" /> </action-mappings>