how to maintain sessions in jsp?can you tellme the methods.
Answers were Sorted based on User's Feedback
Answer / asra
<%session.setAttribute("user","Murali");%>
Below statement you can use in any JSP to print the
welcome message. Start using JSP tags to better performance
and better coding.
Welcome to <%=session.getAttribute("user")%>
| Is This Answer Correct ? | 5 Yes | 6 No |
Answer / faizan samad
String name="faizan";
session.setAttribute("user",name);
String sessionuser=session.getAttribute(name);
out.println("welcome"+sessionuser);
it will display as "Welcome Faizan".
| Is This Answer Correct ? | 17 Yes | 22 No |
Answer / prasanthi
small correction in answer 1:
session.setAttribute("user",name);
using retrive method
//String sessionuser=session.getAttribute(name);
String sessionuser=(String)session.getAttribute(name);
| Is This Answer Correct ? | 6 Yes | 16 No |
How can I override the jspinit() and jspdestroy() methods within a jsp page?
What is the difference in using request.getrequestdispatcher() and context.getrequestdispatcher()?
How can I use jsp in the mvc model?
What is the <jsp:usebean> standard action?
How do we print “<br> creates a new line in html” in jsp?
What is the purpose of <jsp:setproperty >?
What is declaration statement?
What is a expression?
Mention the scope values for <jsp.usebean> tag.
How to works asjx in jsp?
How run jsp program in netbeans?
How to implement a thread-safe jsp page?