配置文件
<package name="notice" extends="default" namespace="/content/notice">
<action name="notice_*" class="action.notice.NoticeAction" method="{1}">
<result name="success" type="dispatcher">/content/notice/addnotice.jsp</result>
<result name="search" type="dispatcher">/content/notice/ListNotice.jsp</result>   
            <result name="input" type="dispatcher">/content/notice/ListNotice.jsp</result>  
</action>
-------------------------action-----------------------------public String getNoticeList() {
String ret = ERROR_JSON;
String noticeType = this.getSingleValParam("noticeType");
if (noticeType != null && !("").equals(noticeType)) {

if (this.session.get("currentLoginUser") != null) {
Login l = (Login) this.session.get("currentLoginUser");
if (("drafts").equals(noticeType)) {

notice.setNoticeSender(l.getLoginId());
notice.setNoticeState(2);

} else if (("receive").equals(noticeType)) {
notice.setNoticeReceiver(l.getLoginId() + "");
notice.setNoticeState(0);
} else if (("send").equals(noticeType)) {
notice.setNoticeSender(l.getLoginId());
notice.setNoticeState(0);
}
// 搜索
if (flag != null && flag.equals("search")) {
notices = noticeBiz.getNoticeList(currentPage, pageSize,
noticeSmallTime, noticeBigTime, notice, orderParam);
} else {
notices = noticeBiz.getNoticeList(currentPage, pageSize,
noticeSmallTime, noticeBigTime, notice, orderParam);
}
int allCount = noticeBiz.getCount(noticeSmallTime,
noticeBigTime, notice);
PageAjax pageAjax = new PageAjax(currentPage, pageSize,
allCount, notices);
this.setJSONResponseData(pageAjax);
ret = SUCCESS_JSON;
} else {
this.setJSONResponseMsg("登录信息异常!");
ret = ERROR_JSON;
}
}
return ret;
}SUCCESS_JSON=“success_json”是这个值

解决方案 »

  1.   

    顺序这样:
    检查自身action中是否有匹配的result,如果有则执行这个result,如果没有则执行下一步
    检查所在的包中的全局result,有匹配的则执行,没有则下一步
    递归查找自己所在包的父包中的全局result,如有匹配则执行,如果还没有struts就会抛出异常。
      

  2.   

    我是用 jquery 的post 提交的 有个回调函数 $.post("content/notice/notice_getNoticeList", arr, function(data){
        
            if (data.msg == "success") {
                var currentPage = data.data.currentPage;
                var allCount = data.data.allCount;
                var pageSize = data.data.pageSize;
                 var result = '<table id="noticeList" width="700" border="1" bordercolor="#2E9AFE" style="border-collapse: collapse">' +
                    '<tr align="center" height="40px" class="list_title" >' +
                    '<td width="70" class="logid"><b>序号</b></td>' +
                    '<td width="100" class="logtitle"><b>标题</b></td>' +
                    '<td width="100" class="logtitle"><b>级别</b></td>' +
                    '<td width="100" class="logtime"><b>时间</b></td>' +
                    '<td width="100" class="noborder"><b>其他</b></td>' +
                    '</tr>';