This is a discussion on JSP Tracking within the Java Server Pages (JSP) forums, part of the Web Development category; I've always wanted to know more about JSP programming. How can I track sessions for JSP pages if the ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| A session is an object associated with a visitor. Data can be put in the session and retrieved from it, much like a Hashtable. If you are programming the site, it is very helpful to be able to associate some data with each visitor. For this purpose, "session"s can be used in JSP. Session variables have the following traits:
Example Use the session object like this... <%I hope it will be useful for you. thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention Last edited by Karpagarajan : 04-17-2007 at 08:19 AM. |
| |||
| First we have a form, let us call it GetName.html <HTML> <BODY> <FORM METHOD=POST ACTION="SaveName.jsp"> What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20> <P><INPUT TYPE=SUBMIT> </FORM> </BODY> </HTML> The target of the form is "SaveName.jsp", which saves the user's name in the session. Note the variable "session". This is another variable that is normally made available in JSPs, just like out and request variables. (In the @page directive, you can indicate that you do not need sessions, in which case the "session" variable will not be made available.) <% String name = request.getParameter( "username" ); session.setAttribute( "theName", name ); %> <HTML> <BODY> <A HREF="NextPage.jsp">Continue</A> </BODY> </HTML> The SaveName.jsp saves the user's name in the session, and puts a link to another page, NextPage.jsp. NextPage.jsp shows how to retrieve the saved name. <HTML> <BODY> Hello, <%= session.getAttribute( "theName" ) %> </BODY> </HTML> Last edited by prasannavigneshr : 04-17-2007 at 11:41 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| List of Bug Tracking Tools | vadivelanvaidyanathan | Testing Tools | 2 | 06-30-2008 02:59 AM |
| Tips for Bug Tracking | vigneshgets | Software Testing | 67 | 12-06-2007 01:34 AM |
| Tracking Server changes... what do all you do? | vadivelanvaidyanathan | Server Management | 1 | 08-14-2007 12:44 AM |
| Tracking all DML and DDL Statements in Database Tables - MYSQL | Murali | Database Support | 6 | 07-16-2007 02:31 AM |
| Nielsen Adds to Cellphone Tracking | vigneshgets | The Lounge | 0 | 06-29-2007 05:29 AM |