register.jsp<%@page contentType="text/html;charset=gb2312" %>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
     <body>
          <form action="register.action" method="post" name="register">
                               用户名:<input type="text" name="user.username"/><br>
                               密 码:<input type="password" name="user.password"/><br>
                               性别:<input type="text" name="user.sex"/><br>
                               年龄:<input type="text" name="user.age"/><br>
                <input type="submit" value="注册"><br>
          </form>
     </body>
</html>
struts.xml<action name="register" class="action.UserAction" method="register">
                 <result name="success">/register_success.jsp</result>
            </action>
action public String register() throws Exception{
System.out.print("sdfsdfsdfsdfsdfsdfs1111111");
userService.saveUser(user);
return SUCCESS;
}

有时行,有时不行,谁能告诉我什么原因啊!!
type Status reportmessage No result defined for action action.UserAction and result inputdescription The requested resource (No result defined for action action.UserAction and result input) is not available.最好告诉我怎么排查错误,先多谢各位大侠啦actioninput

解决方案 »

  1.   

    message No result defined for action action.UserAction and result input
    没有result name=input的结果映射
    如果页面正常输入,后台处理成功,那么走success界面;如果后台校验失败,会把error存放在指定变量中,这时默认result的name为input,而你没有配置,所以报错。
      

  2.   

    我知道加入input能返回,但是我的数据等输入应该是没问题的呀,为什么不能返回到sucess界面呢?而且是有时行有时不行喔,后台中也不能print出字符串。。望指教
      

  3.   

    public String pageQuery(){
    DetachedCriteria detachedCriteria=DetachedCriteria.forClass(User.class);
    PageRequestBean pageRequestBean=initPageRequestBean(detachedCriteria);

    PageResponseBean pageResponseBean=userService.pageQuery(pageRequestBean);
    ActionContext.getContext().put("result", pageResponseBean);
    return "pageQuerySUCCESS";}
    struts.xml 中
    <result name="pageQuerySUCCESS"  type="json">
    <param name="root">result</param>
    <param name="includeProperties">
    total,
    rows\[\d+\]\.id,
    rows\[\d+\]\.username,
    rows\[\d+\]\.gender,
    rows\[\d+\]\.birthday,
    rows\[\d+\]\.station,
    rows\[\d+\]\.telephone,
    rows\[\d+\]\.salary
    </param>
    </result>
    为什么会报错呢?
    10:47:40,044 ERROR Dispatcher:38 - Could not find action or result
    /bos/user_pageQuery.action
    No result defined for action cn.itcast.bos.web.action.user.UserAction and result pageQuerySuccess