`
feigo
  • 浏览: 1571 次
  • 性别: Icon_minigender_1
  • 来自: 广州
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

老问题重提,一直没有找到解决办法!!struts1.2多模块配置

阅读更多
虽然问题很简单,但在网上找遍了各个论坛,最后也没有具体的解决方法,还请各位能够抽空一小会帮助,对入门的新手非常有用,跪谢大家,不要投隐藏呀!

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/struts-config.xml</param-value>
    </init-param>     
     <init-param>
    <param-name>config/fund</param-name>
    <param-value>/WEB-INF/struts-config/struts-config-fund.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>0</load-on-startup>
  </servlet>

struts-config-fund.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="fundForm" type="com.fundSystem.fund.form.FundForm" />

  </form-beans>

  <global-exceptions />
  <global-forwards >
    <forward name="success" path="/success.jsp" />
    <forward name="error" path="/error.jsp" />

  </global-forwards>

  <action-mappings >
    <action
     path="/insertFund"
     attribute="fundForm"
     name="fundForm"
     input="/fund_add.jsp"
     scope="request"
   type="org.springframework.web.struts.DelegatingActionProxy" >
     <forward name="success" path="/success.jsp" contextRelative="true"/>
    </action>

   </action-mappings> 
<message-resources parameter="message_zh_cn" null="false"/>
</struts-config>

jsp页面如下:

<html:form action="/insertFund method="post">
<table width="564" height="82" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2F2F2" bordercolor="#E6E6E6">
   <tr>
    <td width="203" height="28">产品编号:</td>
    <td width="204"><html:text property="fund_no"></html:text>
    *</td>
  </tr>
  <tr>
    <td width="203" height="28">产品名称:</td>
    <td width="204"><html:text property="fund_name"></html:text>
    *</td>
  </tr>
  <tr>
    <td height="26">产品价格(RMB):</td>
    <td><html:text property="price"></html:text>
    *</td>
  </tr>
  <tr>
    <td height="26"> 产品描述:</td>
    <td><html:textarea property="description"></html:textarea>
    *</td>
  </tr>
</table>
<p align="center">
  <input type="submit" name="Submit" value="添加">
 
<input type="reset" name="reset" value="重置">
</p>
</html:form>

输入数据提交后报如下错误,寻求解决方法,在此感激涕零.
message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot retrieve mapping for action /insertFund
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.fund.fund_005fadd_jsp._jspService(fund_005fadd_jsp.java:87)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)





分享到:
评论
19 楼 myyate 2007-10-09  
解决了吗?

<action-mappings > 
<action 
path="/insertFund" 
attribute="fundForm" 
name="fundForm" 
input="/fund_add.jsp" 
scope="request" 
type="org.springframework.web.struts.DelegatingActionProxy" > 
<forward name="success" path="/success.jsp" contextRelative="true"/> 
</action> 
改成:
<action-mappings > 
<action 
path="/sub/insertFund"  //当然你也不一定要用sub可以是其他的
attribute="fundForm" 
name="fundForm" 
input="/fund_add.jsp" 
scope="request" 
type="org.springframework.web.struts.DelegatingActionProxy" > 
<forward name="success" path="/success.jsp" contextRelative="true"/> 
</action> 

然后html中用:
<html:form action="/sub/insertFund method="post"> 

这样你试试看行否?
18 楼 wyhlgx 2007-10-08  
晕死你。。。多模块配置的访问方式不管你有多少个模块,始终要从默认模块开始访问的,然后你通过默认模块再去映射,具体用到org.apache.struts.actions.SwitchAction类。自己查查看吧
17 楼 feigo 2007-09-29  
用如下这种方式配置完全正确,究竟前面那种方式的错误在哪里?这两种方式有何区别,谢谢!web.xml内容:
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config/struts-config.xml,/WEB-INF/struts-config/struts-config-fund.xml</param-value>
    </init-param>
16 楼 feigo 2007-09-29  
因为用的是超链接,URL框里的内容还是登陆时的内容,如下:
http://localhost:8080/fundSystem/salesLogin.do
15 楼 抛出异常的爱 2007-09-28  
点完之后的url框里是什么内容?
14 楼 feigo 2007-09-28  
代码全部贴出来了,请指证.多谢!
 
13 楼 feigo 2007-09-27  
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/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/fund</param-name>
<param-value>/WEB-INF/struts-config/struts-config-fund.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>0</load-on-startup>
</servlet>

struts-config-fund.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="fundForm" type="com.fundSystem.fund.form.FundForm" />

</form-beans>

<global-exceptions />
<global-forwards >
<forward name="success" path="/success.jsp" />
<forward name="error" path="/error.jsp" />

</global-forwards>

<action-mappings >
<action
path="/insertFund"
attribute="fundForm"
name="fundForm"
input="/fund/fund_add.jsp"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="success" path="/success.jsp" contextRelative="true"/>
</action>

</action-mappings>
<message-resources parameter="message_zh_cn" null="false"/>
</struts-config>

fund_add.jsp页面如下:

<html:form action="/insertFund method="post">
<table width="564" height="82" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2F2F2" bordercolor="#E6E6E6">
<tr>
<td width="203" height="28">产品编号:</td>
<td width="204"><html:text property="fund_no"></html:text>
*</td>
</tr>
<tr>
<td width="203" height="28">产品名称:</td>
<td width="204"><html:text property="fund_name"></html:text>
*</td>
</tr>
<tr>
<td height="26">产品价格(RMB):</td>
<td><html:text property="price"></html:text>
*</td>
</tr>
<tr>
<td height="26"> 产品描述:</td>
<td><html:textarea property="description"></html:textarea>
*</td>
</tr>
</table>
<p align="center">
<input type="submit" name="Submit" value="添加">
 
<input type="reset" name="reset" value="重置">
</p>
</html:form>

输入正确密码后进入主页面(可以正常进入),主页面内容如下:

<body bgcolor="#E1E1E1">
<table width="151" height="257" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div id="masterdiv">
  <div class="menutitle" onMouseOver="SwitchMenu('sub1')" onMouseOut="SwitchMenu('sub1')"><img src="img/1.gif" width="180"><span class="submenu" id="sub1"> - <a href="fund/fund_add.jsp" target="bottomFrame">增加基金产品</a><br>    - <a href="fund/fund_find.jsp" target="bottomFrame">查询产品信息</a><br>
  </span> </div><br>
  <div class="menutitle" onMouseOver="SwitchMenu('sub2')" onMouseOut="SwitchMenu('sub2')"><img src="img/2.gif" width="180"><span class="submenu" id="sub2"> - <a href="client/client_add.jsp" target="bottomFrame">添加新客户</a><br>
    - <a href="client/client_find.jsp" target="bottomFrame">查询客户信息</a><br>
  </span> </div><br>
  <div class="menutitle" onMouseOver="SwitchMenu('sub3')" onMouseOut="SwitchMenu('sub3')"><img src="img/3.gif" width="180"> <span class="submenu" id="sub3"> - <a href="financial/financial_add.jsp" target="bottomFrame">资金帐户开户</a><br>
    - <a href="financial/financial_amount_add.jsp" target="bottomFrame">追加资金</a><br>
    - <a href="financial/financial_amount_delete.jsp" target="bottomFrame">取出资金</a><br>
    - <a href="financial/financial_find.jsp" target="bottomFrame">资金帐户查询 </a> </span> </div><br>
  <div class="menutitle" onMouseOver="SwitchMenu('sub4')" onMouseOut="SwitchMenu('sub4')"><img src="img/4.gif" width="180"> <span class="submenu" id="sub4"> - <a href="fund_account/fund_account_add.jsp" target="bottomFrame">购买基金</a><br>
    - <a href="fund_account/fund_account_delete.jsp" target="bottomFrame">基金赎回</a><br>
    - <a href="fund_account/fund_account_find.jsp" target="bottomFrame">基金帐户查询 </a> </span> </div>
</div></td>
</tr>
</table>
</body>

点上面绿色字体的链接报如下错误:还请指点,谢谢!
message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot retrieve mapping for action /insertFund
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.fund.fund_005fadd_jsp._jspService(fund_005fadd_jsp.java:87)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
[color=green][/color]
12 楼 抛出异常的爱 2007-09-27  
抛出异常的爱 写道
错误代码。。。
把错误代码贴出来。。。
11 楼 feigo 2007-09-27  
呵呵,错在哪里撤?能否指明一点,好几个新手都遇到这样的问题.感谢!!
   
10 楼 抛出异常的爱 2007-09-27  
错误代码。。。
9 楼 hellofeigo 2007-09-27  
俺也是初学者,遇到的问题跟楼主差不多,没有找到解决办法.
尚试了以下几种方式,都不行.郁闷中  
<html:form action="/insertFund method="post">
<html:form action="insertFund.do method="post">
<html:form action="/fund/insertFund method="post">
<html:form action="/fund/insertFund.do method="post">
8 楼 cqyaoran 2007-09-27  
和我的一样的问题。顶一下,如果解决了帖出来
7 楼 feigo 2007-09-26  
没人理,怎么回事?看来要去书城找书才行了!
    
6 楼 feigo 2007-09-26  
是否有人可以指点一二...
5 楼 feigo 2007-09-24  
我是通过一个页面链接到fund_find.jsp,现在就是无法链接过去,报错找不到:Cannot retrieve mapping for action /insertFund

我把fund_find.jsp页面改成这样也不行:<html:form action="/fund/insertFund method="post">

<div class="menutitle" onMouseOver="SwitchMenu('sub1')" onMouseOut="SwitchMenu('sub1')"><img src="img/1.gif" width="180"><span class="submenu" id="sub1"> - <a href="fund/fund_add.jsp" target="bottomFrame">添加基金产品</a><br>    - <a href="fund/fund_find.jsp" target="bottomFrame">查询产品信息</a><br>
  </span> </div><br>
4 楼 zhang26chao 2007-09-24  
你查看jsp源码,看form标签生成的具体提交路径是什么?应该是/fund/insertFund才能找到
3 楼 feigo 2007-09-24  
还请兄台留步,我已经在WebRoot下面建立了fund目录,并且相关的JSP页面放在里面了.这个也改成了action="/insertFund,现象依旧.
Cannot retrieve mapping for action /insertFund
郁闷
2 楼 zhang26chao 2007-09-24  
不要急兄弟,你先把jsp中的.do去掉,在web-inf下新建文件夹fund,把这个jsp放在这个文件夹内,然后再提交试试。关键是你查看jsp源码时是否能看到
<form action="/fund/insertFund.do" method=fund" method="post">,如果是这样应该就能找到了。
1 楼 zhang26chao 2007-09-24  
198

相关推荐

Global site tag (gtag.js) - Google Analytics