struts不执行方法

mimi5211 2009-03-20 02:33:12
这是我的ACTION:
public ActionForward selectall(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
System.out.println("before");

UserinfoActionForm userform=(UserinfoActionForm) form;
try {
request.setAttribute("all", DAOFactory.getUserinfoInstance()
.QueryAll());
} catch (Exception e) {

}
System.out.println("after");
return mapping.findForward("list");
}
这是我的JSP:
<a href="user.do?status=selectall">用户管理</a><p>
这是我的配置文件:
<action name="UserinfoForm" path="/user" attribute="UserinfoForm" input="/errors.jsp"
type="cn.telmedia.cmsa.userinfo.action.UserinfoAction" scope="request" parameter="status">
<forward name="success" path="/success.jsp" contextRelative="true"></forward>
<forward name="fail" path="/success.jsp" contextRelative="true"></forward>
<forward name="insertdo" path="/insert_do.jsp"></forward>
<forward name="update" path="/update.jsp"></forward>
<forward name="updatedo" path="/update_do.jsp"></forward>
<forward name="deletedo" path="/delete_do.jsp" contextRelative="true"></forward>
<forward name="list" path="/user/user_list.jsp" contextRelative="true"></forward>
</action>
为什么我点这个的时候<a href="user.do?status=selectall">用户管理</a><p>不执行ACTION里的方法啊?一运行就到了input上的页面上啊?
...全文
95 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
jing9227 2009-04-08
  • 打赏
  • 举报
回复
路径可能有误!
fengyuanfa 2009-04-07
  • 打赏
  • 举报
回复
采用单击<a href="user.do?status=selectall">的形式执行ACTION的话,如果url相同的话,ACTION仅执行一次,你可以在url后追加一个时间,这样每次单击时url都不一样,ACTION就会执行。
<a href="user.do?status=selectall&today=" + new Date().toTimeString()>
jabeginner 2009-04-07
  • 打赏
  • 举报
回复
你的UserinfoAction类没有继承自DispatchAction 吧,所以就不能带参数的执行对应的action方法。;
fenglingcompany 2009-04-02
  • 打赏
  • 举报
回复
你应该用DispatchAction 而不是Action
zhangzhenting 2009-03-25
  • 打赏
  • 举报
回复
配置文件和JSP页面都没有问题,与1楼说的那个重复命名也没有关系,只是那个Action,不晓得楼主是继承 的那个? Action常用的有:ForwardAction,IncludeAction,DispatchAction,LookupDispathAction,还有2楼说的MappingDispatchAction,楼主需要继承DispatchAction或它的子类才可以的。
mumu_java 2009-03-23
  • 打赏
  • 举报
回复
lz的selectall类应该要继承struts中的MappingDispatchAction才能运行.
suncheng_hong 2009-03-21
  • 打赏
  • 举报
回复
不执行action方法,说明你页面有问题,仔细检查看页面上有没有重复命名的表单项,或者对应的属性名称不一致等等。。

50,526

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧