I m totally new to the environment.please guide me how to create a session for user and how to pass the objects to next servlet. for ex i have 4 servlet pages like login.jsp,insert.jsp,update.jsp,delete.jsp. a user should be able to access these pages only after loging in successfully . i have completed the login page,insert page ,update page and they are working proprly. i m running this web app in tomcat with a user database.
I m really glad to see the reply soon. vinnu i have my web app ready with database connectivity.it is a ticketing tool. all mmodules are working fine. no need of forwarding pages. i have set frames after logging in. so i have refference link to get the pages in next frame. all i want to do is to create session to users.
http://localhost:8080/ticketOnline/ is my project but with even logging in if i type http://localhost:8080/ticketOnline/insert.jsp it is taking me to the insert page. this is my problem.
As soon as you login you just generate one query string and append to all URL's and put this into session with some attribute. In each and every page get the query string and check whether the query string is there in the session. After logout you just invalidate the session object. So in each page just add the code to check whether session is null, if not check for query string in session and from request url are same.Otherwise just redirect to Login page if fails above condition.
Hope this may help to you.
mahe kum wrote:all i want to do is to create session to users.
You don't need to create session, the browser creates it, we just need to get the session, using request.getSession();
mahe kum wrote:even logging in if i type http://localhost:8080/ticketOnline/insert.jsp it is taking me to the insert page. this is my problem.
Did you mean, even without logging in?
shiva kumar g wrote:As soon as you login you just generate one query string and append to all URL's and put this into session
Just putting an attribute into session, telling whether the user has logged into the application is enough, there is no need to append any query string to all URL's for this purpose....