Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session

 
dhaval tamboli
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am making simple application .

First User will login using id and password . if thts correct then success.jsp page will open up and on that there is option to create agency mean just to enter new company information. (in which loginid is foreign key).

Now, I want to develop sessions but I am not sure from where to start cause I am not sure whether to do sessions on jsp page or struts2 action class or struts.xml.

I also want to be defined loginid as my session variable so that I can use it on any action class . and a normal login application like if user log out and log in

Defining loginid as my session variable is too much necessary cause Thats only way I can enter agency data into database as such loginid is foreign key.

I am using struts2 and hibernate and mySQL as database.

Looking forward for suggestions.

Thanks
Dhaval
 
Ankit Garg
Sheriff
Posts: 9510
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dhaval please Use A Meaningful Subject Line when you start a topic.

I'm not really sure what your problem is, but if you want to set a session attribute then your action can implement the SessionAware interface. You'll get a Map which will have all the session attributes. You can add your loginid to this Map, that way it will be added as an attribute to the session. If you want to invalidate (end) the session, your action can implement ServletRequestAware interface. That way your action will get HttpServletRequest object from which you can get the HttpSession object and call the invalidate method...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic