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.
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...