| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY 
共有 425 人关注过本帖
标题:无法找到Servlet action
收藏  订阅  推荐  打印 
elemy21
Rank: 1
等级:新手上路
帖子:8
积分:184
注册:2007-4-28
无法找到Servlet action

struts-config.xml

<struts-config>
  <data-sources />
  <form-beans >
    <form-bean name="successForm" type="org.elemy.managerbook.struts.form.SuccessForm" />
    <form-bean name="loginForm" type="org.elemy.managerbook.struts.form.LoginForm" />

  </form-beans>

  <global-exceptions />
  <global-forwards />
  <action-mappings >
    <action
      attribute="successForm"
      input="/index.jsp"
      name="successForm"
      path="/success"
      scope="request">
      <forward name="success" path="/success.jsp"></forward>
      <forward name="error" path="/error.jsp"></forward>
     </action>
    <action
      attribute="loginForm"
      input="/index.jsp"
      name="loginForm"
      path="/login"
      scope="request">
      <forward name="login" path="/jsp/login.jsp"></forward>
      <forward name="error" path="/error.jsp"></forward>
     </action>

  </action-mappings>
  <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"></controller>

  <message-resources parameter="org.elemy.managerbook.struts.ApplicationResources" />
  <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
    <set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml" />
  </plug-in>
</struts-config>
当我把<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
    <set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml" />
  </plug-in>
<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"></controller>
去掉的话,就会正常执行,
大家帮帮忙
搜索更多相关主题的帖子: action  Servlet  xml  
2008-5-29 08:55
菜鸟也疯狂
Rank: 2
等级:注册会员
帖子:134
积分:1524
注册:2007-3-20

你是想整合struts和spring吧。spring为struts提供了三种支持方式:使用spring的ActionSupport;使用spring的DelegatingRequestProcessor;还有就是全权委托的方式。
   你用的是第二种,这样你必须要让你的Action继承org.springframework.web.struts.DelegatingRequestProcessor。而且你的<action-mapping>里面没有映射到你要创建的那个Action,这是有问题的。增加一个type="你的Action"。
   建议使用第三种:全权委托。你只需要在配<action-mapping>的时候让type="org.springframework.web.struts.DelegatingActionProxy",这样你就可以在spring里完成你的Action创建和依赖注入。

2008-5-30 11:33
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.063196 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved