spring+struts配置找不到action,请帮忙解答,折腾好几天了:(
struts配置如下
<?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="regForm"
type="com.yourcompany.struts.form.RegForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action attribute="regForm" input="/reg.jsp" name="regForm"
path="/reg" scope="request"
type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="suc" path="/suc" />
</action>
</action-mappings>
<controller
processorClass="org.springframework.web.struts.DelegatingRquestProcessor">
</controller>
<message-resources
parameter="com.yourcompany.struts.ApplicationResources" />
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/classes/applicationContext.xml" />
</plug-in>
</struts-config>
applicationContext配置如下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean name="/reg" class="com.yourcompany.struts.action.RegAction"
abstract="false" singleton="true" lazy-init="default"
autowire="default" dependency-check="default">
</bean>
</beans>
jsp页面如下
<%@ page language="java" contentType="text/html; charset=gb2312"%>
<%@ 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>
<TITLE>报修记录</TITLE>
<head>
<meta http-equiv="Pragma" content="no-cache" />
<link href="../../css/style.css" rel="stylesheet" type="text/css">
</head>
<BODY>
<form name="login" action="/reg" method="post">
<!-- 隐藏字段 -->
<input type="hidden" name="method" value="add">
<!-- input type="hidden" name="createdDate"-->
</form>
</BODY>
</html>
<script>
login.submit();
</script>
地址栏输入http://127.0.0.1:8088/test/reg.jsp
然后自动跳转到http://127.0.0.1:8088/reg
报错信息如下:
HTTP状态404 - /reg
--------------------------------------------------------------------------------
type 状 态 报 告
信 息 /reg
描 述 没有所要求的资源(/reg)
地址栏输入 http://127.0.0.1:8088/test/reg.do
报错
HTTP状态404 - 无法找到Servlet action
--------------------------------------------------------------------------------
type 状 态 报 告
信 息 无法找到Servlet action
提前谢谢您的指点