标题:sping_struts结合
只看楼主
Aiping_love
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-4-10
 问题点数:0 回复次数:0 
sping_struts结合

本人做了一个spring和struts的结合 结果找不到我的action不知道什么原因 请各位大哥帮忙看看,以下是我的配置文件。

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="regForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="username" type="java.lang.String" />
<form-property name="fromwhere" type="java.lang.String" />
<form-property name="userpass" type="java.lang.String" />
<form-property name="userEmail" type="java.lang.String" />
<form-property name="otherplace" type="java.lang.String" />
</form-bean>
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action name="regForm" path="/reg" scope="request" parameter="method" validate="false" type="org.springframework.web.struts.DelegatingActionProxy" />
</action-mappings>
<message-resources parameter="com.yourcompany.struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/ConnBean.xml,/WEB-INF/ApplicationContext.xml,/WEB-INF/ActionBean.xml" />
</plug-in>
</struts-config>


ActionBean.xml

<?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.Action.RegAction">
<property name="users">
<ref bean="users"/>
</property>
</bean>

</beans>



web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<filter>
<filter-name>mycode</filter-name>
<filter-class>jeg.Code</filter-class>
</filter>
<filter-mapping>
<filter-name>mycode</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- <filter>
<filter-name>myurl</filter-name>
<filter-class>jeg.Url</filter-class>
</filter>
<filter-mapping>
<filter-name>myurl</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
<!-- spring 数据池的加载 -->
<servlet>
<servlet-name>proxoolServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>/WEB-INF/classes/proxool-conf.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>AdminP</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.admin.servlet.AdminServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AdminP</servlet-name>
<url-pattern>/AdminP</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>ActionServlet</servlet-name>
<servlet-class>net.showti.struts.ActionServlet</servlet-class>
</servlet>
<!-- spring 数据池的加载 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml,/WEB-INF/ConnBean.xml,/WEB-INF/ActionBean.xml,/WEB-INF/ActionBean.xml</param-value>
</context-param>

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>net.showti.struts.ActionServletUTF8Encoding</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>

页面转向的form
<form method="post" action="/reg.do" name="reg" >
本人急等用请各位大哥帮帮看看

搜索更多相关主题的帖子: sping struts 结合 
2007-09-29 14:40



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-174011-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.506558 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved