日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

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

編輯Tag賺U幣

推薦:Struts2訪問servlet分享
Struts2訪問servlet分享

復(fù)制代碼 代碼如下:www.hl5o.cn

public class DeviceAction extends AbstractAction implements ModelDriven<Device> {
private static Log log = LogFactory.getLog(DeviceAction.class);
private Device device=new Device(); //只能json化 模型驅(qū)動(dòng)的bean
private String result; //無法返回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ù)制代碼 代碼如下:www.hl5o.cn

<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ù)制代碼 代碼如下:www.hl5o.cn

<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>

分享:javaweb之web入門基礎(chǔ)
javaweb之web入門基礎(chǔ),需要的朋友可以參考一下

來源:模板無憂//所屬分類:JSP教程/更新時(shí)間:2013-04-22
相關(guān)JSP教程