我使用struts1.2来做一个网站,首页index.html包括两个表单form1,form2,表单的属性如下:
<form id="form1" name="form1" method="post" action="index-1.do">
<form id="form2" name="form2" method="post" action="index-2.do">
一次只提交一个表单的数据,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="cheCiForm" type="wind.CheCiForm"/>
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action path="/pages/index" type="wind.CheCiAction" name="cheCiForm" scope="request" >
<forward name="cc_success" path="/pages/cc_result.jsp" redirect="true"/>
<forward name="cc_faild" path="/pages/cc_result.jsp" redirect="true"/>
</action>
</action-mappings>
</struts-config>
我把所有页面文件都放在"WEB-ROOT/pages/"路径下的,我预想的流程是:登录index.html页面,选择任意一个表单输入数据,提交之后通过action拦截index.do然后根据查询的结果重定向到cc_result.jsp页面来显示查询的结果,现在就是在index.html提交数据之后出现如下错误:
HTTP Status 404 - Invalid path /pages/index was requested--------------------------------------------------------------------------------type Status reportmessage Invalid path /pages/index was requesteddescription The requested resource (Invalid path /pages/index was requested) is not available.无论我怎么改struts-config.xml中action的path属性都始终报这个错,我尝试把index.html和cc_result.jsp两个页面放到WEB-ROOT根路径但是无法实现重定向,页面地址停留在index.do上,我配置redirect="true"应该会重定向到cc_result.jps上的嘛,希望大家帮我看看,谢谢!
<form id="form1" name="form1" method="post" action="index-1.do">
<form id="form2" name="form2" method="post" action="index-2.do">
一次只提交一个表单的数据,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="cheCiForm" type="wind.CheCiForm"/>
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action path="/pages/index" type="wind.CheCiAction" name="cheCiForm" scope="request" >
<forward name="cc_success" path="/pages/cc_result.jsp" redirect="true"/>
<forward name="cc_faild" path="/pages/cc_result.jsp" redirect="true"/>
</action>
</action-mappings>
</struts-config>
我把所有页面文件都放在"WEB-ROOT/pages/"路径下的,我预想的流程是:登录index.html页面,选择任意一个表单输入数据,提交之后通过action拦截index.do然后根据查询的结果重定向到cc_result.jsp页面来显示查询的结果,现在就是在index.html提交数据之后出现如下错误:
HTTP Status 404 - Invalid path /pages/index was requested--------------------------------------------------------------------------------type Status reportmessage Invalid path /pages/index was requesteddescription The requested resource (Invalid path /pages/index was requested) is not available.无论我怎么改struts-config.xml中action的path属性都始终报这个错,我尝试把index.html和cc_result.jsp两个页面放到WEB-ROOT根路径但是无法实现重定向,页面地址停留在index.do上,我配置redirect="true"应该会重定向到cc_result.jps上的嘛,希望大家帮我看看,谢谢!
解决方案 »
- 删除按钮点击没反应
- 一个专门为IT从业人员服务的网站
- 初学者请教关于:<%@ include%>命令
- socket在action里接受jsp表单提交的数据
- 數據庫關鍵字查詢遇到的問題﹐請高手指點﹐在線等﹗
- 有什么好方法学习Dhtml,(表单的跳转关系,提交等等)
- 如何将查询结果以excel电子表格的形式下载给浏览器用户?
- 一个比较麻烦的问题?applet通过servlet访问数据库,怎么给applet返回一个记录集?
- A question
- 没有与“try”搭配的“catch”或“finally”
- 论SOA的开发(国内几乎没有人敢吃这第一只螃蟹) 讨论 散分~
- java聊天室的问题,麻烦高手给加个私聊和登陆提示!
<html:form action="pages/index">我忘记是不是 /pages/indexstruts 是根据你form中的action来找 struts_config.xml文件中的path
↑
你的xml文件中的path="/page/index"有问题,可否这样写path="index-1"你看一下这个配置:
<action attribute="ArchivesFlowCouser" name="archivesFlowCouser"
parameter="method" path="/displayFlowCouser"
input="/archivesSaveFlowCouserTemplet.jsp" scope="request"
type="com.oa.struts.action.FlowCouserAction">
<forward name="archivesSaveFlowCouserTemplet"
path="/archivesSaveFlowCouserTemplet.jsp" />
</action>
只是做参照。有不明白在问吧!