ssh整合中,struts和spring整合出错,求教!

watertk 2007-06-20 11:59:19
ssh问题,请帮助


ssh初学者,请高手多出手。
在学习ssh1时,struts和spring整合中出现问题,后来我甚至完全照着wolfuni老师ssh1视频一步一步做下来,还是出现了同样的问题,问题如下(应该还是我粗心的问题吧,但好几次就是没找出来,郁闷!!):

经过测试就是在作spring代理类时出错。也就是在struts-config.xml中加上plug-in插件时,就会出错(测试后struts正常)。

报错如下:

HTTP Status 404 - /test3/user.do

--------------------------------------------------------------------------------

type Status report

message /test3/user.do

description The requested resource (/test3/user.do) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.16
仅仅是页面出这样的错,控制台没有任何东西,tomcat日志中也没有任何记载。

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="userForm" type="com.tst.Usertable" />

</form-beans>

<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="userForm"
input="/user.jsp"
name="userForm"
path="/user"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy">
<forward
name="mail"
path="http://mail.163.com"
redirect="true" />
</action>

</action-mappings>

<message-resources parameter="com.tst.struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>
</struts-config>
去掉plug-in,然后将action中type改为原来就好了。

applicationContext.xml中bean为:
<bean id="UsertableDAO" class="com.tst.UsertableDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>

<bean name="/user" class="com.tst.struts.action.UserAction"
abstract="false" lazy-init="default" autowire="default"
dependency-check="default">
<property name="userdao">
<ref bean="UsertableDAO"/>
</property>
</bean>
不知问题出在哪里,请老师和高手指教。
...全文
310 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
seamhb 2008-12-10
  • 打赏
  • 举报
回复
你好,我也出现这样的问题,我的原因可能是jar包冲突,我把hibernate的以an开头的jar包删掉就没问题了,
不知道你是不是也是这个原因,我觉得如果代码没问题那就是jar包的问题了
watertk 2007-06-21
  • 打赏
  • 举报
回复
谢谢以上两位(pengtao0615、coder000)。

首先,学习中据我了解,ssh中各自都能实现MVC功能,之所以整合起来一起用,是因为分别用到了各自的最优秀部分,最近正在看spring的书,还没有涉及到spring的MVC。初学不是很深,有什么不对的,请多指教!

经过反复测试,我以前用的spring2.0,会出现以上错误,即plug-in插件代理action导航无效,出现了404错误。而后来换成spring1.2就不会出现错误。请问这是什么问题?是spring2.0不支持struts的这个plug-in吗?
coder000 2007-06-20
  • 打赏
  • 举报
回复
spring 配置文件里代理action 的 bean 配置了没,看下~~
还有plug-in里的 applicationContext.xml 的位置对了没,生成默认好像是在classes里的
pengtao0615 2007-06-20
  • 打赏
  • 举报
回复
把你的WEB.XML贴出来我看看
pengtao0615 2007-06-20
  • 打赏
  • 举报
回复
建议你能看看SPRING的MVC架构,摒弃STRUTS,毕竟STRUTS现在已经人老珠黄了(个人感觉),不过我还是会继续关注你的帖子的

67,515

社区成员

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

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