posted 19 years ago
Please allow to ask a follow-up question. If "session" is an implicit thing server creates for me, then in my JSP1-->Servlet-->Action-->JSP2 process, In the "Action" class the "execute(request, response)" method involves adding some new attirbutes to the session. Now the question are --
1. If I use "session.setAttribute("name", myVar) in the JSP1, then in "Action" class I can NOT use "HttpSession session = new HttpSession();" any more, right ? I can only add attributes like "request.getSession().setAttribute("name2," anotherVar);", is this right ?
2. If I don't do anything with session in JSP1, then in "Action", do I need to write "HttpSession session = new HttpSession();" before I add attributes. It seems Yes, right ? Then I am confused, why ? it seems there is already "session" created by the server in JSP1, so why can't I just directly use it in "Action" ?