当前位置: 代码迷 >> J2EE >> 在struts.xml中使用result type="json" 怎么在ajax中获得值
  详细解决方案

在struts.xml中使用result type="json" 怎么在ajax中获得值

热度:92   发布时间:2016-04-17 23:23:55.0
在struts.xml中使用result type="json" 如何在ajax中获得值
从来没用过struts配置文件中返回类型是json的

<action name="listProduct" class="createGiftQueryAction" method="listProduct">
<result type="json">
<param name="root">productList</param>
</result>
<result type="json" name="noProduct">
<param name="errMsg">errMsg</param>
</result>
<result type="json" name="noUserId">
         <param name="errMsg">errMsg</param>
</result>
</action>

我现在在action中有一个字符串private String errorMsg="错误",如何能在页面ajax中获得这个字符串的值呢?struts配置文件,包括action要怎么写呀?谢谢大神赐教!
------解决思路----------------------
参考下,原理是一样的
http://blog.csdn.net/jationxiaozi/article/details/6827764/
  相关解决方案