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
What is the purpose of
What is the
What is out println in jsp?
What is jstl jar?
A jsp page, include.jsp, has a instance variable "int a", now this page is statically included in another jsp page, index.jsp, which has a instance variable "int a" declared. What happens when the index.jsp page is requested by the client?
Why should we not configure jsp standard tags in web.xml?
How to deactivate el on jsp?
Hi, I've applied for HPCL(Information System Officer)& UIIC (A).Plz send me previous/sample papers and any suggestions regarding this exam.Please advice me good study material or related links. Thanks in advance shyam shyamprasad71@gmail.com
What are the jsp lifecycle phases?
Differentiate between include directive and include action.
What are the different scope values for the
What is client side technology?
What is custom tag library?
Explain the various scope values for tag.
Can we override jsp service method?