求助:调试了快一天了,快郁闷得不行了
我看得是孙卫琴的struts那本书。现在在理解那个addressbook的例子。感觉还可以。但现在遇到个问题。
struts-config.xml文件中与search有关的配置:
<form-beans>
<form-bean name= "logonForm " type= "addressbook.forms.LogonForm "/>
<form-bean name= "searchForm " type= "addressbook.forms.SearchForm "/>
<form-bean name= "insertForm " type= "addressbook.forms.InsertForm "/>
</form-beans>
<!-- ========Global Forward Definitions===============-->
<global-forwards>
<forward name= "logoff "path= "/logoff.do "/>
<forward name= "logon "path= "/logon.jsp "/>
<forward name= "success "path= "/mainMenu.jsp "/>
<forward name= "search "path= "/search.jsp "/>
<forward name= "displayall " path= "/displayall.do "/>
<forward name= "insert "path= "/insert.jsp "/>
<forward name= "mainMenu "path= "/mainMenu.jsp "/>
<forward name= "confirmation "path= "/confirmation.jsp "/>
</global-forwards>
<action-mappings>
<actionpath= "/search "
type= "addressbook.actions.SearchAction "
name= "searchForm "
attribute= "myForm "
scope= "request "
input= "/search.jsp ">
<forwardname= "success " path= "/display.jsp "/>
</action>
....
</action-mappings>
在jsp页面中
<html:form action= "/search.do " focus= "name ">
在SearchAction中:
覆盖了execute方法最后返回
return(mapping.findForward( "success "));
我理解的是应当返回到display.jsp页面。
现在的问题是,在jsp查询页面中提交,地址栏变成:
http://localhost:8080/AddressBook/search.do
什莫也没有了
我在SearchAction中写了到log的跟踪,发现根本没有执行SearchAction,这是为什莫呢。还请指点一下啊
[解决办法]
讨厌struts1.*
配置复杂死了。
建议大家使用struts 2.0
[解决办法]
在web.xml里这个写对了吗
<servlet-mapping>
<servlet-name> action </servlet-name>
<url-pattern> *.do </url-pattern>
</servlet-mapping>
[解决办法]
加 <forward name= "search "path= "/search.do "/>
TOMCAT 再起一下试试
[解决办法]
如果程序正确的话,应该能走到return;
另外,总共有两个success看一下试不是冲突呀什么的
[解决办法]