精华帖 (0) :: 良好帖 (0) :: 新手帖 (1) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-09-25
spring和struts有三种集成方式啊。
2.1 在struts-config.xml中加入ContextLoaderPlugIn ContextLoaderPlunIn是Struts 1.1+ 的插件,用来为 Struts 的 ActionServlet 加载 Spring的Application Context。这个Context引用 WebApplicationContext (由 ContextLoaderListener 加载) 作为它的父Context。默认的context文件是映射的 ActionServlet 的名字,加上 -servlet.xml后缀。 如果 ActionServlet 在 web.xml 里面的定义是 action, 那么默认的文件就是 /WEB-INF/action-servlet.xml。 格式如下: <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"/> 2.2 在Struts-config.xml中加入DelegatingRequestProcessor 用Spring的DelegatingRequestProcessor重载Struts 默认的 RequestProcessor。这样当收到一个针对Action的请求时,DelegatingRequestProcessor会自动从Spring Context中查找对应的Action Bean。 格式如下: <controller> <set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/> </controller> 2.3 建立struts-config.xml与action-servlet.xml中Action与Bean的对应关系 连接 struts-config.xml 和 action-servlet.xml 中的 Action与Bean的桥梁是action 的"path"和 bean 的"name"。 如果你在 struts-config.xml 文件中有如下配置:<action path="/users" .../> 你必须在 action-servlet.xml 中将 Action bean 的名字定义为 "/users":<bean name="/users" class="..."/> 设定完以后,action的type属性可以省略不写,因为所有的Action都在Spring Context中寻找。注意这里bean用的是name属性,而不是id,因为"/"在id属性中是非法字符。 |
|
返回顶楼 | |
发表时间:2007-09-25
404 struts配置问题
|
|
返回顶楼 | |
发表时间:2007-10-02
兄弟,看看本人写的这个东西,有没有收获???
http://mhqawjh.iteye.com/blog/128748 |
|
返回顶楼 | |
发表时间:2007-10-03
别整了,找个现成的,比如说Appfuse
|
|
返回顶楼 | |
发表时间:2007-10-04
看看hbing的代码吧
struts-config配置错误 需要配置代理bean 不过spring新的配置方式不需要这样配 struts-conifg还是照struts配法 参考下springside |
|
返回顶楼 | |
发表时间:2007-10-10
action的PATH有问题
|
|
返回顶楼 | |
发表时间:2007-10-13
在你的struts中的action配置中,应该加上这样一句话
type="org.springframework.web.struts.DelegatingActionProxy" 原因:你这里利用的是Spring委托的方式与Struts集成。 分析下你的代码: 你给出了URL,然后程序会在Struts配置文件里面找相应的Action,但是根本找不到。所以你要把这个任务交给Spring的一个类,让它去帮你找,加上上述代码以后,程序就会在Sring的配置文件里找,这样才找到了你自定义的Action处理类。大功告成!!! |
|
返回顶楼 | |
发表时间:2007-11-15
这个问题我也碰过,应该是spring和hibernate结合有问题,你试着把
<property name="mappingResources"> <list> <value>org/xredleaf/dao/Sysuser.hbm.xml</value> </list> </property> 这配置注释掉,再运行,如果成功的话那真的是spring和hibernate的结合问题,关于这个问题我也正在困扰之中,急求别人帮我解决啊!!!我的同学跟我说过试着用桥连接,这样成功率会大点 |
|
返回顶楼 | |
发表时间:2007-11-16
直接使用Struts2 配置起来比较简单
|
|
返回顶楼 | |
发表时间:2007-12-27
在struts配置文件中使用controller
试一下 |
|
返回顶楼 | |