wlq530 2011-08-30 13:13
浏览 307
已采纳

extjs 与java 交互,怎么搞都连接不上啊,帮我看看啊

[code="java"]
Ext.Ajax.request({
url : '/jlyw/notice/gd_notice!queryNoticeList.action', //连不上啊,这里
method : 'post',
async : false,
success : function(result,request) {
var msg = result.responseText;
alert("dwdwdw"); //没反应啊
Ext.get("gdnotice").dom.innerHTML = '

滚动公告: '+msg+'
';
},
failure : function() {
    }
})

[/code]

[code="java"]
package com.jlyw.actions.notice;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.bestnet.base.action.BaseAction;
import com.jlyw.services.notice.noticeService;
import com.jlyw.vos.notice.noticeVo;

@SuppressWarnings("serial")
public class Gd_noticeAction extends BaseAction{
@Autowired
private noticeService service;

private noticeVo noticevo;

@SuppressWarnings("unchecked")
public void queryNoticeList() throws IOException, ParseException {
        List list = service.getFirstList();
        StringBuffer sb = new StringBuffer();
        noticeVo backnotice = null;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        for (int i = 0; i < list.size(); i++) {
            backnotice = (noticeVo) list.get(i);
            sb.append("<li>");
            long dif = sdf.parse(sdf.format(new Date())).getTime() - sdf.parse(backnotice.getCreateTime()).getTime();
            if (dif/(1000*3600*24) > 7) {
                sb.append("<a href='../../adm/backnoticefirst!getById.action?id=" + backnotice.getId() + "' target='_blank'>" + "【" + backnotice.getNoticeType() + "】" + backnotice.getTitle() +  "</a>&nbsp;&nbsp;&nbsp;" + backnotice.getCreateTime().substring(0, 10));
            } else {
                sb.append("<a href='../../adm/backnoticefirst!getById.action?id=" + backnotice.getId() + "' target='_blank'>" + "【" + backnotice.getNoticeType() + "】" + backnotice.getTitle() +  "</a>&nbsp;&nbsp;&nbsp;"
                    + backnotice.getCreateTime().substring(0, 10) + "<img src='../../Images/new.gif'></img>");
            }
            sb.append("</li>");
        }
        write("<ui>" + sb.toString() + "</ui>");
    }

public noticeService getService() {
    return service;
}

public void setService(noticeService service) {
    this.service = service;
}

public noticeVo getNoticevo() {
    return noticevo;
}

public void setNoticevo(noticeVo noticevo) {
    this.noticevo = noticevo;
}

}

[/code]

  • 写回答

13条回答 默认 最新

  • myali88 2011-08-30 15:56
    关注

    出错也不是坏事,能知道更多框架的使用和实现。如果一开始什么都对了,可能对于为什么这么整合,哪里是关键点,都不会知道。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(12条)

报告相同问题?

悬赏问题

  • ¥15 用三极管设计一个单管共射放大电路
  • ¥20 fluent无法启动
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题
  • ¥15 LCD12864中文显示
  • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
  • ¥15 gsoap生成onvif框架