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 |
What is out in jsp?
Why does _jspService() start with an ‘_’ but other lifecycle methods do not?
What is <jsp:usebean> in jsp?
What is scriptlet in jsp?
What are scriptlets in jsp?
What is tag file?
What is the difference between directive include and jsp include?
What are jsp action tags?
What are the different types of jsp tags?
What are the literals used in jsp?
What is difference between sendredirect and forward?
Is it possible to share an httpsession between a jsp and ejb? What happens when I change a value in the httpsession from inside an ejb?