日期:2014-05-18  浏览次数:20702 次

郁闷了好多天的struts路径问题
jsp页面里是这么写的:
<form   name= "form "   action= "searchNode.do "   method= "post "   onsubmit= "return   validate(this) ">
<table   width=100%   cellpadding= "0 "   cellspacing= "0 ">
<tr> <td> </td>
<td   align= "right ">
<strong> <h5> 搜索节点: </strong>
<select   name= "type ">
<option   value= "nodeip "> IP地址 </option>   checked
<option   value= "nodemac "> MAC地址 </option>
<option   value= "nodename "> 节点名称 </option>
</select> &nbsp;
<input   type= "text "   name= "content "> </input>
<input   type= "submit "   value= "搜索 "   name= "Submit ">
</td>
</tr>
</table>
</form>

struts-config.xml里面是这么写的:
<action   path= "/searchNode "   type= "netinsight.structure.actions.TopSearchAction "   name= "TopSearchForm "   parameter= "search "   scope= "request "   input= "/asset/error.jsp "   validate= "false ">
                <forward   name= "searchNode "   path= "/topo/pages/objectinfo.jsp "/>
                </action>
action类继承MappingDispatchAction   form继承ActionForm

为什么会抱Invalid   path   was   requested错误呢?请高手指点一下,多谢!

------解决方案--------------------
表单form的action属性的标准写法是必须以 "/ "开头.所以 <form name= "form " action= "/searchNode.do ".
这些是基础知识.