$(document).ready(function(){
$("#sighEdIn").click(function(){
$.ajax({
url:"userSigh!sighEdIn.action",
type:"GET",
dataType:"text",
error:function(XMLHttpReques,errorThrown)
{
alert(XMLHttpReques);
},
success:function(data)
{
alert("您现在积分是:"+data);
}
});
alert("hi");
})
})
public void sighEdIn() throws IOException
{
int jifen=ifSighEdInToday()
System.out.println("aa");
HttpServletResponse res = ServletActionContext.getResponse();
res.reset();
res.setContentType("text/html;charset=gb2312");
PrintWriter pw = res.getWriter();
pw.print("20");
pw.flush();
pw.close();
}
public int ifSighEdInToday()
{
int integratio=0;
ActionContext actionContext = ActionContext.getContext();
Map session = actionContext.getSession();
UserInfo user=(UserInfo) session.get("user");
Date sighEdIn_time=user.getSighEdIn_time();
Date today=new Date();
System.out.println(today.getTime()+":"+sighEdIn_time.getTime());
int days = (int) Math.abs((today.getTime() - sighEdIn_time.getTime())
/ (24 * 60 * 60 * 1000)) ;
integratio=user.getIntegration();
if(sighEdIn_time==null||days>0)
{
user.setSighEdIn_time(new Date());
integratio+=3;
user.setIntegration(integratio);
userManger.updateUser(user);
}
return integratio;
}
前面那个是我页面有一个标签,点击标签出发ajax。。。后台响应。。后面一段是我的响应。。问题是这样的。。在后台sighEdIn()方法中有第一句的该方法就进不去,去掉第一句就可以进入该方法。。。郁闷啊