How to manage session tracking in jsp

how to track user account upto when he log out from the application. and tell me how to develop secure page.

You've posted this to the wrong forum: this forum is about Java Web Start, which is a product of Sun Microsystems.

Similar Messages

  • How to do session tracking in JSP

    I want to do session tracking in my JSP pages.Say once after the user logs in,on every page I can get his username for further use.Thank you for your help!
    Richard

    <%
    session.setAttribute("svUserName", request.getParameter("name_of_username_form_field"));
    // from the login page
    %>
    then to retrieve,
    <% String UserName;
    UserName = (String)session.getAttribute("svUserName").toString(); %>
    to display,
    <%= UserName %>

  • How to use session object in jsp

    hi all
    marry christmas
    can anyone plz tell me how to use session obect in jsp
    rachna
    Message was edited by:
    rachna_arora82

    hi rachna,
    JSP has a default(implicit) session object...... use the getSession(true) method on the session object and then going u can either get or set attributes depending on the requirement
    That was in general and now with the issue u have got..... what u can do is that the u can create session for every user who logs in and when he/she tries to login again then u can probably check for the existing session object in the JSP and perform the logic as required..... any clarifications plzzzzzzz let me know
    Thanks n Regards
    Naveen M
    Message was edited by:
    Novice_inJAVA
    Message was edited by:
    Novice_inJAVA

  • How to manage session ?

    Hi Java Gurus,
    Can any body tell me how to manage session in java.
    I have two url say http://www.xyz/userlogin.php, http://www.xyz/sendsms.php
    1st url gives the login form and second one coes after succesfull login.
    Now I am not using any web browser. I have to surf these pages through java code using java api ( HttpURLConnection, HttpSession, URL etc...).
    I am able to access login form, but after login when I connect second url, it gives session expired message in the html stream.
    This is because I am not managing session. So can any body have any idea or pointer. How I can manage sesssion and access second page after succesfull login.
    I will appreciate your help.
    Thanks and regards -
    Vikas Kumar Sahu.

    The session is managed as a cookie (JSessionID if I'm not mistaken). So what you need is a way to obtain all cookies from an url and send them back to the server. Apache HttpClient is your best bet:
    http://jakarta.apache.org/commons/httpclient/cookies.html

  • Sub :  How to manage session ?

    Hi Java Gurus,
    Can any body tell me how to manage session in java.
    I have two url say http://www.xyz/userlogin.php, http://www.xyz/sendsms.php
    1st url gives the login form and second one coes after succesfull login.
    Now I am not using any web browser. I have to surf these pages through java code using java api ( HttpURLConnection, HttpSession, URL etc...).
    I am able to access login form, but after login when I connect second url, it gives session expired message in the html stream.
    This is because I am not managing session. So can any body have any idea or pointer. How I can manage sesssion and access second page after succesfull login.
    I will appreciate your help.
    Thanks and regards -
    Vikas Kumar Sahu.

    What I do in some of our test-clients is that I call the login and get all the cookies from the header and add them to the next request.
    More or less what pkwooster suggested.
    Also, I suggest that you take a look at http://jakarta.apache.org/commons/httpclient/
    and the Example code http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/examples/CookieDemoApp.java?view=markup
    Message was edited by:
    Lajm

  • How to use session tracking

    i am making shopping mall project .
    ist page conatins list of product avaiale
    2nd page contains list of manufacturuer avaible
    problem:-
    i want to display on 3rd page the product seleted by user in 1st page
    i used session tracking concept.but problem is the value is coming null in third page
    please tell me how to solve my problem

    If it is like a shopping cart, I suggest you to look for a good shopping cart examples available plenty online.
    But if its just about keeping session variables and using them the following works.
    Test with a simple example. Have three jsp files like a.jsp, b.jsp and c.jsp.
    put the following in a.jsp
    <% session.setAttribute("Mobile","Nokia");%>
    <%=session.getAttribute("Mobile")%>
    <a href="b.jsp">Go to B.jsp</a>Print the value of session variable - <%=session.getAttribute("Mobile")%> in b.jsp and c.jsp
    And in b.jsp have a link to c.jsp and so on. Once you set a session variable, it lives as long as your session doesnt expire.
    Try it. and also look for more session tracking examples online.
    Message was edited by:
    passion_for_java

  • How to use session variable in JSP function  & How to use both JSP  Servlet

    Hi,
    I am new to JSP and servlets
    Still I am devloping a website in JSP. I am not mixing JSP with servlets, but I do create Java files for bean, logic and database works.
    I try to keep the hard coding part out of JSP.
    I dont how to use both JSP and Servlets in combination.
    Hence If needed I write some functions in JSP.
    but it gives me error
    +<%! public void abc()+
    +{+
    int intUserId = Integer.valueOf((Integer) session.getAttribute("MySession_UserID"));
    +}+
    +%>+
    Saying cannot find symbol session
    1) So can u please tell how can I access session variables within JSP function
    2) And also give me some links/tutorials about useing both JSP and Servlets in combination.
    Thanks
    Venkat

    The application architecture when you use Servlets and JSP in a standard MVC pattern is explained here (under the heading "Integrating Servlets and JSP Pages") and here ...

  • How to retrieve sessions variables in JSP

    hi,
    I am trying to retrieve session variable from servlet to JSP.
    In the servlet i am retrieving employeenames from database and storing them in a ArrayList variable then i am setting this variable into the session.
    When retrieving the session in the jsp it displays as [empname1, empname2].
    Please help how to retrieve them
    Thanks in Advance,
    sha

    At the servlet:
    ArrayList<String> employeeNames = new ArrayList<String>();
    employeenames.add(blahBlahblah);
    session.setAttribute("eNames", employeeNames);
    At the JSP:
    ArrayList<String> names = (ArrayList<String>) session.getAttribute("eNames");
    for (String nom : names) {
    do something with the name stored in String variable nom...
    }

  • How to update session in processLaunch.jsp

    Hi,
    When i am creating End user form, i have
    createuser
    edituser
    selfservice
    in the form, when i click first 'createuser' processLaunch.jsp redirect to 'createuser' form based on attributes in request object.
    Then i click 'back' button then click on 'edituser' still it goes to 'createuser' form.
    How to update session or use request object to change.
    my code.
    <%@ page import="com.waveset.session.Session,
    com.waveset.session.UserViewConstants,
    com.waveset.ui.util.PageProcessor,
    com.waveset.ui.util.RequestState,
    com.waveset.ui.web.task.TaskLaunchForm,
    com.waveset.ui.LoginHelper,
    com.waveset.view.ProcessViewer"
    %>
    <%@ include file="../includes/headStartUser.jsp" %>
    <%
    String pageTitle = req.getLocalizedString("UI_LAUNCH_PROCESS", _locale);
    String bodyAttributes = "onload=\"selectFirstEditField();\"";
    TaskLaunchForm form = new TaskLaunchForm();
    try {
    // should we let the process view specify its own title?
    form.setTitle(pageTitle);
    form.setSubTitle(req.getLocalizedString("UI_LAUNCH_PROCESS_INFO", _locale));
    form.setPostURL(response.encodeURL("user/processLaunch.jsp"));
    form.setNextURL("user/main.jsp");
    form.setWorkItemURL("user/workItemEdit.jsp");
    // let the view know we're in the end-user gui
    req.setOption(ProcessViewer.OP_END_USER, "true");
    String url = form.process(req);
    if ( url != null ) {
    LoginHelper.redirect(req, out, url);
    return;
    catch (Throwable th) {
    form.addError(th.getLocalizedMessage());
    %><%= com.waveset.util.Util.stackToHtmlComment(th) %><%
    %>
    <%@ include file="userHeader.jsp" %>
    <%= form.generateHTML() %>
    <%@ include file="userFooter.jsp" %>
    <%@ include file="../includes/poolSession.jsp" %>
    it is urgent , pls. let me know.
    thanks

    in the jsp, set the scope to request. it might help. u might also want to re-direct it to a new jsp which is a copy of the existing processLauch.jsp to avoid fiddling around with the old one. :)

  • Session tracking in JSP pages

    I've two pages in my web application which need regular refresh after a particular interval.I'm using
    (session.setMaxInactiveTime) to check the session validation.& HTML's <META> tag to regularly refresh the page after particular interval.
    On these two pages there are links to the different pages for which i'm opening a new window.
    But i'm losing the session after some time & i'm not able to catch the source from where the session is getting invalidated.even when i'm using meta tag of html to refresh the page.
    I'm also using HttpSessionEventListener Interface to know when the session.putValue & session.removeValue
    functions are used.
    I hope the problem is clear to you people.
    an urgent help/suggestion will be appreciated.
    thanks in advance

    Hi,
    it isn't easy see your problem. When you losing your session? When you hava open a link from your page i a new browser window (instance) and return?
    Also check follow: when no validate session exist, a jsp open a new session, else you use <%@ page session="false" %>
    Roland

  • How to use Session scope in jsp page

    Hello, I have login form, where user provides username and password. Then click on submit, it will forward to validation.jsp. Where it will check in database make sure username and password exit. Now i can also retrive accountid of perticular user. I want to put that username and accountid in session scope. so all other pages can use that username and accountid. How can i do that. I'm new at this, so please provide me example too. Here is my code for login.jsp and validation.jsp..
    Validation.jsp
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    //String name = request.getParameter( "username" );//
    //session.setAttribute( "accountID",accountID );//
    <%
    String connURL = "jdbc:oracle:thin:@orca.csc.ncsu.edu:1521:ORCL";
         Connection conn = null;
         Statement stmt = null;
         ResultSet rs = null;
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    conn = DriverManager.getConnection(connURL, "vapatel","pjdas");
    stmt = conn.createStatement();
    String user=request.getParameter("userName");
    String password=request.getParameter("password");
    boolean entrance=false;
    stmt.excuteQuery("SELECT AccountID From Password WHERE USERNAME='"+user+"'");
    rs = stmt.executeQuery("SELECT * FROM Password WHERE USERNAME='"+user+"' AND PASSWORD='"+password+"'");
    while(rs.next()){
    String dbUser = rs.getString("USERNAME");
    String dbPassword= rs.getString("PASSWORD");
    if ((user.equals(dbUser)) && (password.equals(dbPassword))){
    entrance=true;
    if (entrance==true){%>
    <jsp:forward page="form.jsp"/>
    <%}
    else{%>
    <jsp:forward page="login.jsp"/>
    <%}
    %>

    hi,
    to put something into session scope in a jsp page use:
    session.setAttribute("counter", Integer.toString(5));to retrieve is from a jsp page use:
    String counterAttribute = (String)session.getAttribute("counter");

  • Session tracking in JSP

    hi,
    we have used JSP and JavaBeans in a simple employee database kindof application. each employee has a manager and some details. an employee logs into the system using his employee id and a password and performs related tasks.
    we are unable to maintain session details for the same. we have a login bean which contains the employee id and password and these details are forwarded to each JSP page when required but somehow the data is getting mixed up. for instance, if two users sign in at the same time then the data for the two is gettign mixed up and there is no demarcation for the same.
    can anyone help me with this ?
    thanks in advance

    If you are using a bean to maintain user data, then declaring this with session scope is all you need to do to keep the information seperate.
    Make sure that data the bean accesses is not shared in any way, for example, if you use a common class to access the database, make sure each bean instantiates its own copy.
    Are you testing this with two users on different machines? If testing on one machine, firefox does not allow multiple sessions, IE does.

  • How to manage sessions of two diiferent applications using SSO

    Im new to JAVA , i have two different apllication with different session management, How to make it a common session management, how to reset the timer program in JAVA for every 300 secs.Please help me out with ideas and send me the sample code timer program that can run for 300 secs and it has to be reseted when requests comes if there is any, otherwise it has to log out

    Yes total users should be around 5000, but there could be around 500 users accessing concurrently. Besides we are using to BOE to show a dashboard, with charts and graphs(using the HTMLView) so we will have to 500 concurrent IEnterprise sessions. I just hope that:
    1. Each session is unique(independent thread) although they have logged on using the same credentials
    2. The CMS server can scale upto this number(500). Don't know if there are some caching options available?

  • How to manage sessions in a central place instead of the one owns the session?

    hi:
    in my application i load all the users profile into session, when i change the
    user's profile ,i wanna synchronize the profile in the session instead of when user
    login again. But i find no api may help to managing the session .
    there 's other two choices:
    1. i can put all the users profile in application context, but i am not sure when
    working with weblogic cluster, will these be replicated among all the clustered servers.
    2.put all the users in the single instance , so every user can visit this instance
    , but here the cluster problem lies too.
    regards
    daniel wang

    We did a web app a while ago and used image files for warehouse to show images of parts
    1. BLOB
    2. We didn't use adf. also I am using 10.1.3.4.

  • How can manage session in javafx desktop application

    i have created a javafx desktop application and  my application also consume  restWebService for login and logout puspose. now how i can maintain session of any particular user??
    please if u have any idea let me know??
    thanx in advance.

    With the setup you have described, you don't need to maintain much of a session like in a traditional browser or a web app server scenario. 
    WIth a traditional web application, when a login authentication passes, normally a cookie is set in the browser to indicate that a session has been established and is cleared on logout to indicate that the session is over.  When the browser client talks to the server it sends the cookie across to the server and the server (using something like the servlet api) decodes the cookie to determine the session and makes use of appropriate session state to access a store of session related data which it eventually just throws away on logout or on session timeout.  The cookie is normally a random piece of data which forms a unique id for the session and is normally generated on the server.
    If you are using rest apis then they should be coded to be stateless, so there is no session involved, every request to the server is self contained and contains all the information required to authenticate the user.  (e.g. the user/password hash is passed every time).  Sometimes a variant will be used where a token is passed, for example an oauth token, representing delegated authentication from another service.  But you likely don't need to do that and just passing the full auth information everytime is sufficient.  The server itself also maintains no state, it just does the auth based on the credentials passed with each request and then performs what ever action it needs to create and return the resource requested.
    So really, all you need to do is to:
    1. Prompt user for login credentials (user/pass).
    2. Hash the pass and make a rest call to the server for validation (http basic auth over https could be used for this).
    3. If the auth passes, then store the current user/pass hash as application data somewhere (e.g. members of your application class instance).
    4. When you need to make another rest call, query the application instance for the user / pass hash and include that in the call.
    5. When the user logs out, clear the user / pass hash from the application (set it to null).
    6. Show the login prompt again for the user.
    Note that using other communications systems (such as akka, hessian, spring remoting etc), may be a bit simpler for some kinds of JavaFX client/server applications than using REST.

Maybe you are looking for

  • Error while loading data to Infocube using DTP.

    Dear All I am facing problem while uploading data in Zinfocube. Up to PSA the data is loaded and not showing any error but when we try to upload the data from PSA to INFOCUBE through a DTP, It ens up showing error message (Error while updating to tar

  • How to extract data on the diagonal of a square matrix

    Hi, I am quite new to this. I have Labview 7.1. I am having a bit of trouble with the following: I have a square array and would like to extract the data ocurring on the diagonal of this array into a 1d array. Can anyone help me with this? Kind regar

  • Problem with access to SMTP, IMAP, POP3 protocols in CAS 2013.

    Hi, we have problem with access thgrough SMTP, IMAP, POP3 protocols in CAS 2013. If I test connection to SMTP 25 port from other computer, session end quickly. Test from CAS2013 to localhost or public IP is OK (similar also for IMAP and POP3). Receiv

  • How to find the select statement has written all selected values into text

    Hi, I am using form6i. i am selecting a set of values from database tables based upon some user parameters and writing into the text file using Text_io.put_line . In this case how we can make sure that the text fille contains all the data what we are

  • Multiple foreign key joins between two tables

    Hi, I have a question about building a repository. I have a date dimension and one fact. The fact table has about 10 foreign key columns that link to the date Dimension. In this case should I create 10 aliases to create joins in the Physical and BMM