File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session in struts

 
zaheer agadi
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how is session implememted and maintained in struts?
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Zaheer,
You may maintain sessions by putting it in the Action class(Controller).You may check all the action classes for the loginForm(which contains the username and password) and accordingly allow access or invalidate a users session.
---------
Example:
---------
public final class LoginAction extends Action
{
public ActionForward execute(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws Exception
{
LoginForm loginForm=(LoginForm)form;
//Call Business Logic Class
// Some Logic

// Set the session bean
HttpSession session = request.getSession();
session.setAttribute("loginForm", loginForm);
}

return(mapping.findForward("login"));
}

Hope that is alright.. I believe posting specific questions would help better rather than such generic questions.
Reagrds,
Roshani
 
Brent Sterling
Ranch Hand
Posts: 948
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts is really a pretty thin layer over top of the basic servlet architecture. The short answer is that sessions are maintained in struts just like they are in a servlet based application. So you have specific questions?

- Brent
 
zaheer agadi
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnx Roshni and Brent calrifyin my doubt i just wanted to know is der any different way in struts to handle session, thnx
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic