Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session in Struts

Status
Not open for further replies.

pajarokillo

Programmer
May 3, 2004
30
ES
hi, in which class in the struts's framework is the best place for to do a session control?
 
subclass RequestProcessor to create your own controller, override method processPreprocess. processPreprocess is the first method being call for all ActionServlets. In there, you can put in your own session control stuff. e.g.

Code:
package yourPackage

public YourRequestProcessor extends o
rg.apache.struts.action.RequestProcessor {

  public boolean processPreprocess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) {
    super.processPreprocess(request, response);

    // session control logic here....

  }
}


To tell Struts to use your own controller, in struts-config.xml file

Code:
<controller processorClass="yourPackage.YourRequestProcessor" contentType="text/html"/>;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top