主頁(yè) > 知識(shí)庫(kù) > struts2中action實(shí)現(xiàn)ModelDriven后無(wú)法返回json的解決方法

struts2中action實(shí)現(xiàn)ModelDriven后無(wú)法返回json的解決方法

熱門標(biāo)簽:地圖標(biāo)注專業(yè)和非專業(yè) 汝南縣地圖標(biāo)注app 湖北地圖標(biāo)注公司 外呼直播語(yǔ)音系統(tǒng) 山東ai外呼電銷機(jī)器人好用嗎 智能電話機(jī)器人銷售話術(shù) 四川正規(guī)外呼系統(tǒng)軟件 福建電銷貓機(jī)器人收費(fèi) 甘肅銷售電銷機(jī)器人公司

復(fù)制代碼 代碼如下:

public class DeviceAction extends AbstractAction implements ModelDrivenDevice> {
    private static Log log = LogFactory.getLog(DeviceAction.class);
    private Device device=new Device(); //只能json化 模型驅(qū)動(dòng)的bean
    private String result; //無(wú)法返回reslut的json值

   
    public String getResult(){
        return result;
    }
    public void setResult(String result){
        this.result=result
    }
    public DeviceDTO getModel() {
        return device;
    }
    public Device getDevice() {
        return device;
    }
    public void setDevice(Device device) {
        this.device = device;
    }
}            

xml配置:

復(fù)制代碼 代碼如下:

action name="queryPu"
            class="com.jxj.bss.web.actions.DeviceAction"
            method="queryPu">
            interceptor-ref name="isLogin">/interceptor-ref>
            result type="json">
                param name="includeProperties">
                    resultCode
                /param>
            /result>
        /action>

解決辦法:

復(fù)制代碼 代碼如下:

action name="queryPu"
            class="com.jxj.bss.web.actions.DeviceAction"
            method="queryPu">
            interceptor-ref name="isLogin">/interceptor-ref>
            result type="json">
                param name="root">action/param>
                param name="includeProperties">
                    resultCode
                /param>
            /result>
        /action>

您可能感興趣的文章:
  • 詳解在Java的Struts2框架中配置Action的方法
  • ajax交互Struts2的action(客戶端/服務(wù)器端)
  • struts2 action跳轉(zhuǎn)調(diào)用另一個(gè)程序
  • Struts2中Action中是否需要實(shí)現(xiàn)Execute方法
  • 用js模擬struts2的多action調(diào)用示例
  • 在Action中以Struts2的方式輸出JSON數(shù)據(jù)的實(shí)例
  • Struts2之Action接收請(qǐng)求參數(shù)和攔截器詳解
  • Struts2 ActionContext 中的數(shù)據(jù)詳解
  • struts2通過(guò)action返回json對(duì)象
  • Struts2學(xué)習(xí)教程之Action類如何訪問WEB資源

標(biāo)簽:肇慶 白銀 黔東 吳忠 南充 臨沂 昌都 梅州

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《struts2中action實(shí)現(xiàn)ModelDriven后無(wú)法返回json的解決方法》,本文關(guān)鍵詞  struts2,中,action,實(shí)現(xiàn),ModelDriven,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《struts2中action實(shí)現(xiàn)ModelDriven后無(wú)法返回json的解決方法》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于struts2中action實(shí)現(xiàn)ModelDriven后無(wú)法返回json的解決方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 企业400电话

    智能AI客服机器人
    15000

    在线订购

    合计11份范本:公司章程+合伙协议+出资协议+合作协议+股权转让协议+增资扩股协议+股权激励+股东会决议+董事会决议

    推薦文章