In struts2 actions, the request object, Session object, and application object cannot be directly used, because it does not want the struts1 action, and the execute parameter in it contains the above object, so what should we do when we need to load objects through objects such as request ???
① Get the request and other objects in Acton
Request object: httpservletrequest request = servletactioncontext. getrequest ();
Response object: httpservletresponse response = servletactioncontext. getresponse ();
Session Object: httpsession session = request. getsession ();
Application Object: servletcontext = servletactioncontext. getservletcontext ();
② Load data into objects such as requests in the action
Actioncontext AC = actioncontext. getcontext ();
AC. getapplication (). Put. ("applicationname", object); // Application
AC. getsession (). Put. ("sessionname", object); // session
AC. Put ("requestname", object); // request