HttpSession interface’s setAttribute() method is used to set attribute in session object.
Syntax: public void setAttribute(String name,Object value);
Example: session.setAttribute(“attName”, “attValue”);
See more at: HttpSession in servlet.
- What is a Web application?
- What is a Web browser?
- What is different between web server and application server?
- What is a servlet container?
- What is MIME Type?
- Why do we need a constructor in a servlet if we use the init method?
- When servlet object is created?
- Who is responsible for creating the servlet object?
- What is the difference between HttpServlet and GenericServlet?
- What is HTTPServletRequest class?
- What is HTTPServletResponse class?
- How can we create deadlock condition on our servlet?
- For initializing a servlet can we use a constructor in place of init()?
- How to read form data in servlet?
- How to write html contents using servlets?
- How to send an authentication error from a servlet?
- What is servlet collaboration?
- What is lazy loading?
- How do we call one servlet from another servlet?
- What is the difference between sendRedirect and RequestDispatcher?
- Can we call a jsp from the servlet?
- How to configure a central error handling page in servlets?
- How to get session object?
- How to set attribute in session object?
- How to get attribute from session object?