public String log(){ //登录的时候设置
HttpServletRequest q=ServletActionContext.getRequest();
HttpSession s=q.getSession();
if(this.shop.login(uname, password)){
s.setAttribute("username", uname);
user=this.shop.users(uname);
s.setAttribute("u", user);
try{
FileReader fr=new FileReader("F:\\my.txt");
br=new BufferedReader(fr);
String t=br.readLine();
time=Integer.parseInt(t);
time++;
FileWriter fw=new FileWriter("F:\\my.txt");
bw=new BufferedWriter(fw);
bw.write(time+"");
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(br!=null){
br.close();
}if(bw!=null){
bw.close();
}
}catch(Exception e){
e.printStackTrace();
}
}
return SUCCESS;
}return INPUT;
}
Login.jsp
<font color="#cc9933">浏览<s:property value="time"/>次数</font>