This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpSession doubt

 
Ashok Pradhan
Ranch Hand
Posts: 180
Eclipse IDE Firefox Browser Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Numbers of previous attemptes does not change after second attempt to call the servlet .Please suggest what is the problem with my servlet:--
Here is my servlet code :-
 
Jonathan Elkharrat
Ranch Hand
Posts: 170
Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your ctr variable is local, it's scope is the method only.
try to store it in the session:

if (session.isNew()) {
msg = "Hello new User";
session.setAttribute("counter",ctr);
}
else {
msg = "Welcome back";
ctr=(Integer)session.getAttribute("counter")+1;
session.setAttribute("counter",ctr);
}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic