I am having trouble understanding the differences between these three ways of setting attributes:
// String as attribute of request req.setAttribute("name", "Sluggo"); // Integer as attribute of session req.getSession().setAttribute("age", 10); // Date as attribute of context getServletContext().setAttribute("today", new Date());
- What are the differences?
- When should you use each?
source share