Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

click button to clear session  RSS feed

 
Li Jenny
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

after updated to database, i will pass a update successfually or fail to the user by request.getSession().setAttribute in servlet
and in the jsp, just read the session.

on question, i would like to ask when can i clear the session as when the user click another button, the message still here.
how to clear the session when the user click another button.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add a form for each button and inside form add this .


test is your session attribute.
 
Li Jenny
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where should i put the code
in button ??

i have a form and containing the button.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add a form for each button
and place same servlet as action for all forms.
inside the form add hidden fild.
 
Fidel Edwards
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ll Gii wrote:where should i put the code
in button ??

i have a form and containing the button.


You can call an AJAX action for onclick event of your button.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!