Struts+hibernate+spring, 多模块Struts配置文件, 不能找到spring的DelegatingActionProxy?

kexsong 2006-02-28 04:09:04
1. web.xml
...
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/sys</param-name>
<param-value>/WEB-INF/struts-pc-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
...
2. struts-config.xml
...
<action
path="/test"
type="org.springframework.web.struts.DelegatingActionProxy"
scope="request"
parameter="method"
validate="false">
<forward name="succeed" path="succeed.jsp" redirect="true"/>
</action>
...
3. struts-sys-config.xml
...
<action
path="/test2"
type="com.test.action.TestAction"
scope="request"
parameter="method"
validate="false">
<forward name="succeed" path="succeed.jsp" redirect="true"/>
</action>
...
4.applicationContext.xml
...
<bean name="/test" class="com.test.action.TestAction"></bean>
<bean name="/test2" class="com.test.action.TestAction"></bean>
...
我运行:http://localhost:8080/myapp/sys/test2.do后出现如下的错误:
javax.servlet.ServletException: No bean named '/sys/test2' is defined
...
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '/sys/test2' is defined
...
请问在struts配置有多个模块,设置了spring的DelegatingActionProxy后,怎么除了这多模块的问题?非常感谢

...全文
230 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
木有昵称啦啦 2006-03-06
  • 打赏
  • 举报
回复
怎么解决的,说一说,让大家分享一下。呵呵!
kexsong 2006-03-03
  • 打赏
  • 举报
回复
这问题我终于解决了
梦幻圣者 2006-03-02
  • 打赏
  • 举报
回复
为了在Struts中加载Spring Context,你可能要在struts-config.xml中增加如下部分:
<struts-config>
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/applicationContext.xml" />
</plug-in>
</struts-config>
或在其他地方配置spring容器。
梦幻圣者 2006-03-01
  • 打赏
  • 举报
回复
3. struts-sys-config.xml
...
<action
path="/test2"
type="com.test.action.TestAction"
scope="request"
parameter="method"
validate="false">
<forward name="succeed" path="succeed.jsp" redirect="true"/>
</action>
-----------------------------
上述配置中,type怎么直接取值“com.test.action.TestAction”,怎么不是使用“org.springframework.web.struts.DelegatingActionProxy”代理,当然spring会找不到的。因为这个bean没有交给spring容器去管理啊。
zeq258 2006-03-01
  • 打赏
  • 举报
回复
关注下,学习!
laoer 2006-03-01
  • 打赏
  • 举报
回复
你Spring的WebApplicationContext是怎么启动的呢?
kexsong 2006-03-01
  • 打赏
  • 举报
回复
谢谢smallbird105(快乐鸟) 的提醒
更正:
3. struts-sys-config.xml
...
<action
path="/test2"
type="org.springframework.web.struts.DelegatingActionProxy"
scope="request"
parameter="method"
validate="false">
<forward name="succeed" path="succeed.jsp" redirect="true"/>
</action>
其实我的是这样的,只是后来copy过这发贴子的时候copy错了.

skycncomp 2006-02-28
  • 打赏
  • 举报
回复
招聘
java工程师
java jsp servlet spring hibernate js css
上面会一部分既可

qq 283765999
地点:北京
kexsong 2006-02-28
  • 打赏
  • 举报
回复
有没高手知道的?分不够可以加的啊
mysohu 2006-02-28
  • 打赏
  • 举报
回复
学习中....

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧