当前位置: 代码迷 >> 综合 >> webx3 ajax实践
  详细解决方案

webx3 ajax实践

热度:68   发布时间:2023-12-21 19:44:21.0
webx3处理ajax很简单,需要注意的是别忘了家cache-control,今天没有加这个,IE浏览器下会cache住ajax请求。


public class RateAdd {

@Autowired
private RateService rateService;

@Autowired
private HttpServletResponse response;

public void execute(@Param("placeId") Long placeId) throws IOException {
response.addHeader("Cache-Control", "no-cache");
response.setContentType("application/json");
PrintWriter out = response.getWriter();
boolean result = false;

if (placeId == null) {
out.write(String.valueOf(result));
return;
}

result = rateService.createRate(AuthContext.getContext().getMemberId(), placeId);
out.write(String.valueOf(result));

}
}
  相关解决方案