title: What all to store in session object of ActionContext in Struts2?
body: <p>I want to know what <strong>all kind of data</strong> one must store in the session map of ActionContext?</p>
  
  <p>For example:</p>
  
  <p>From a jsp after an event is triggered, control goes to my action class.
  In my action class if i get some data from database and want that data to be rendered in the next jsp to be displayed, so shall I store that data in session map or in some other object of ActionContext like parametres, application,request, etc ??</p>
  
  <p>I am adding the following variables in my session map: </p>
  
  <pre><code>        session.remove("MESSAGE"); // Some message Strings
          session.remove("ERROR");// Some Error Strings
          session.remove("TSRequestDetailsMap");    // Dto Map from DB
          session.remove("TowerReqGenDtoMap");
          session.remove("RequestFileName");
          session.remove("ResponseFileName");
          session.remove("ResponseFileDetailsDto");// DTO
          session.remove("Output");// Output Strings
          session.remove("RequestType");
  </code></pre>
  
  <p>Is it right to put such variables in session or shall i keep some of them in other like in application map or ValueStack ???</p>
  
  <p>My MESSAGE and ERROR strings are not field errors/messages particular to a field but messages in general like if the map got from DB comes empty, etc. Something like this: </p>
  
  <pre><code>            tsReqDetailsMap = slsRequestResponseDetailsLocal.getRequestDetailsForTargetSuspect(operatorIds, requestType, startDate, endDate,loginMode);         
              if(!tsReqDetailsMap.isEmpty()){
                  session.put("TSRequestDetailsMap", tsReqDetailsMap);
              }else{
                  session.put("MESSAGE", "Request not found for specified time period for "+requestType);
              }
  </code></pre>