how to maintain sessions in jsp?can you tellme the methods.
Answer Posted / tarak
In the state page u have to set the session
<% Session ses=request.getSession(true);%>
Then set an atribute for the session.
<% ses.setAttribute("attribute","valid session");%>
Session: <% =ses.getAttribute("attribute");%>
(It will display Session: valid session)
Before you close or logout invlidate the session and remove
attribute
<% ses.removeAttribute("attribute");
ses.invalidate();%>
Everytime at the start of page we can check for the value
of sesion attribute. If it is set, then the session will be
valid. Otherwise invalid session.
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Mention some important jsp action tags.
What is translation phase?
What is cookie with example?
Is jsp front end or backend?
Can we define a class in a jsp page?
What is an api with example?
How to find out the name of the http method using jsp el?
What is action tag in jsp?
Why don’t we need to configure jsp standard tags in web.xml?
How can we extend jsp technology?
Why should we not configure jsp standard tags in web.xml?
how can i add properties in dynamic text fields using .js file?
What is cookies in jsp?
How do I perform browser redirection from a jsp page?
Explain jsp action elements or action tags?