views:

90

answers:

2

In struts, where does the session object created & which class or method creates it? Likewise where does the request object created & which class or method invokes it?

Thanks in advance

+1  A: 

The request object is created inside your servlet container (tomcat/jetty/whatever).

The session is basically created by whoever calls getSession on HttpServletRequest first. Normally web frameworks do this only when someone actually declares they need the session. If you want to find out when this happens, I suggest you use "go to implementation" in your IDE and set a breakpoint and run the application (note there are two overloads)

krosenvold
A: 

In Struts an ActionForm instance can be stored in the HttpSession or in the HttpServletRequest.

It depends on the scope defined in the action tag inside the struts-config.xml file.

An ActionForm usually gets stored using the name defined in the action-form tag.

oscargm