为什么struts2 ajax 方法执行两次

 时间:2026-04-26 03:13:16

struts2中使用json插件执行ajax处理时,如果方法名是get方法的时候,方法会莫名其妙的执行两次。 原因: struts2 中JSON的原理是在ACTION中的get方法都会序列化,所以前面是get的方法只要没指定不序列化,都会执行解决方法

Action中的业务方法前别加get 或者 set(属性的get set 除外) 

用@JSON(serialize=false)指定方法不序列化如import com.googlecode.jsonplugin.annotations.JSON;@JSON(serialize=false) public String getChild() throws Exception{ .............. .............. return "success"; } 

   

  • struts2 ajax的实现
  • struts2中怎么防止表单重复提交
  • 在struts2中如何实现转发
  • struts2流程详解
  • struts2如何处理一表单多提交
  • 热门搜索
    微信银行卡怎么解绑 颈椎病怎么治 为什么不能摸死人的手 头晕恶心想吐是怎么回事 嗓子干痒咳嗽怎么办 桃酥的做法大全 电脑为什么没有声音 耳朵后面长了个包一按就疼怎么办 贷款利息怎么算 高血压头晕怎么办最快最有效