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

Similar Messages

  • How to use session in webservice?

    In C#, can use session variable in a webservice object.
    How to use session in Java webservice?
    Who can give me a example?
    Thanks a lot

    Did I use session in a wrong way?No, you are using the session correctly. The code looks fine.
    Check
    - your spelling of the attribute names - obviously they must match
    - the ids of the sessions you get both times: session.getId(). If they have different ids, then most probably the session is being lost somewhere.
    There are a number of reasons to lose a session. If you close the browser, invalidate the session in code, or lose the cookie recording the id. This happens when you change from https to http, so a session can be lost that way.
    The session is normally maintained by session cookies. If you close your browser you lose the cookie. If you have disabled cookies on your machine then it also might not work.
    In cases such as that you should be using the method response.encodeURL() to maintain the session for you in any hyperlinks you produce. Struts normally handles that for you though if necessary.
    Hope this helps,
    evnafets

  • 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 use Event Tracking Code for Google Analytics in Dreamweaver CS5

    I need to track clicks on links that go to an outside website. I've read about "event tracking code". I'm not sure if it's the right tool to use. And if it is, I've spent several hours reading about it and I can't figure out how to use it. It looks like you need to be an expert developer to be able to make sense of all this. I've always been helped when I ask a question here, I'm hoping that someone can help me.
    What my client needs is to know what links are being clicked, and how often. Here's the page where I want to do this: Available Homes - Arizona Vacation Home Rentals 
    I added a code that I created using the tool I found here: General Event Tracking Code for Google Analytics but can't see to be able to make this work. I added this code to the first link called "View it Here" for the top, left house. Here's the code: <a href="http://www.homeaway.com/vacation-rental/p3495538" onClick="ga('send', 'event', { eventCategory: 'clicks', eventAction: 'clicks on homes', eventLabel: 'Clicked'});" target="_blank">View it HERE!</a> 
    Then I set a Goal in Google Analytics like it said in the instructions but it doesn't seem to work... I would APPRECIATE ANY HELP!
    Thanks,
    Brigitte

    I think you misunderstood what Event Tracking is designed for.  This is from Google Help
    Tracking Code: Event Tracking - Google Analytics — Google Developers
    "Use this to track visitor behavior on your website that is NOT related to a web page visit, such as interaction with a Flash video movie control or any user event that does not trigger a page request."
    Clicks on links are page requests.  I think for your purposes, you may want the Cross Domain Link Tracking plugin.
    Cross Domain Tracking - Web Tracking (analytics.js) - Google Analytics — Google Developers
    Nancy O.

  • 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");

  • 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 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 cookie property of System object?

    Hi all,
    I have searched all over the SDN but didnt get anything relevent so here i am posting my query...
    My scenario is as follows:
    I have created a KM document iview that launches an HTML page, on click of button of HTML page a VC iview is launched. On this iview i have a button that hits BI query.
    PS: A system object is created for the connectivity bet portal and backend BI server.
    PS: i have configured SSO between portal and backend.
    Now when i click on button on iview that fetches the data from backend, i am asked for authentication pop-up, although i have configured SSO why i am asked to enter UID and PWD again??
    In system object there is a property named
    <b>"session cookie = MYSAPSSO2"</b>
    So should i use this property so that cookie will get transfered from one session to other session when i click button on iview??
    If yes then HOW??
    Is there any other setting remained in Visual Admin?? or Backend or portal?
    What could be the missing??
    PS: User id are same on portal & backend.
    Any help will be highly appreciated...
    Regards,
    Ameya
    Thanks in advance
    Message was edited by:
            Ameya Pimpalgaonkar
    null
    Message was edited by:
            Ameya Pimpalgaonkar

    Hi Ameya,
    I do not know the exact answer.However you should look for something called JSESSION ID.
    Have a look at the thread:
    Re: Problems Using Application Integrator for BSP Application
    Reg SSO Logon Tickets and Browser sessions
    How to use jsessionid while making HTTP calls??
    Hope you find something which can help you.
    Regards
    Atul Shrivastava

  • How to use Session Broker ? (Where to add Session Broker Code)

    Hi all,
    My requirement is, I have to use two different database session in one Top Link.
    I know it can be done using Session Broker, but where actually I need to add that code ? I am using JDeveloper 10.1.2.0.0(Build 1811) as i need to implement this in a BPEL process. Is it possible use Session Broker with this version , if so how to do that ?
    Thanks in advance,
    Anant.

    Hello Anant,
    Not sure what code you are refering to. Using a SessionBroker is similar to how you would use a regular session, and can be configured using sessions.xml or through java code. If you are using java code, you would do this where ever you first acquire the sessionbroker and login.
    Please refer to the docs on what it is and how it is used:
    http://download-west.oracle.com/docs/cd/B25221_04/web.1013/b13593/sesun007.htm#CACGDDHE
    The docs are for TopLink 10.1.3, and though I think TopLink 10.1.2 (9.0.4.5) is what ships with Jdev 10.1.2, they should still apply.
    Best Regards,
    Chris

  • How to use Form tracking (T.code-J1IUN)

    Hi all,
    How to use the form tracking.and How to use the J1IUN. Can anybody help give a details idea how to track the C form wether the customer is giving the form againt the billing document .
    Thanks in advance.
    Regards,
    Abhijit.

    hi
    As per indian C form business process J1IUN will not meet the requirements.
    we have to develop Z programme for this, logic is
    1. Transaction one is  all CST 4 % or 3 %  invoices we have to store in Z table. (daily by creating Z tcode)
    2. second  transaction is maintain the C from numbers for respective invoice numbers ( by crating Z code)
    3.develop 2 reports, one is invoices with C from numbers another one is invoices with out c form numbers.
    so by sitting with u r abaper u can give above solution

  • How to use session in Struts

    Hello, there:
    It's a simple question.
    I have a web app which has a login page, in its action class I create an object, user, and save it into session by using request.getSession(true).setAttribute("user", user).
    In another action class, I want to use the info of user then I use request.getSession(true).getAttribute("user"); however, the returned object is NULL. Did I use session in a wrong way?
    Thanks,
    Sway

    Did I use session in a wrong way?No, you are using the session correctly. The code looks fine.
    Check
    - your spelling of the attribute names - obviously they must match
    - the ids of the sessions you get both times: session.getId(). If they have different ids, then most probably the session is being lost somewhere.
    There are a number of reasons to lose a session. If you close the browser, invalidate the session in code, or lose the cookie recording the id. This happens when you change from https to http, so a session can be lost that way.
    The session is normally maintained by session cookies. If you close your browser you lose the cookie. If you have disabled cookies on your machine then it also might not work.
    In cases such as that you should be using the method response.encodeURL() to maintain the session for you in any hyperlinks you produce. Struts normally handles that for you though if necessary.
    Hope this helps,
    evnafets

  • How to use session state protection

    I use Apex 3.2.1
    I access my site by a url passing a parameter like this : f?p=101:1:0::::ITEM1:1234567. There is no login and password to access the site.
    The value of the parameter ITEM1 is the authorization of the first page, with a database function for the verification.
    To secure my site I want to use session state protection so, I enabled it , then I defined "Arguments Must have checksum" for the page 1.
    Now , when i try to acces my site with the same url it does not work.
    it is the first time a try to use session state protection, could someone tell me what's wrong?

    Hi user5719906,
    I would suggest that as you need to pass an item and are unable to generate a checksum as you are not yet logged in, that you will need to allow arguments without checksum for this page.
    This could be a bit of a hole in your security, but as long as you know it is there and clear the cache for all pages that you branch to, you should be able work around it.
    The issue is that a malicious user can set page and application items via the url to an unsecured page.
    Regards
    Michael

  • How to use session object in windows application

    hi, I am programming in jdeveloper. i need to know that while i m making a web application i can use a session object for the particular session. now i m builiding a windows application for my final semester and i need to insert product id and then it should go to another frame and there it can store multiple information for a particular product id.
    e.g
    product id : 001
    next frame.
    filter name.
    filter position.
    when these are added then it should be able to add more filters for the same product id and i dont understand how to do that.
    Please let me know as i am lost and dont know how to proceed further. if some body wants to have a look on the codes he is most welcome.
    Waiting for an answer
    thank you

    Hi,
    in Swing applications you don't have a session object to store data. You can use a helper class though to act as a temporary memory. Just create a static class that has a hashtable method to add / read / remove data
    Frank

  • How to use session messages ?

    Hi Friends,
    As we know , when any auth error during login , we setup message
    Like " INVALID LOGIN" or "AUTH FAIL" but this message remains until
    we login another time.
    If is there any way, when message is displayed and if we refresh message
    is removed out. ( just like we use it on cakePHP ). called Flash messages.
    How do I achieve in java / jsp ??
    Any Help appreciated....

    Then, like I said, put that message into the request scope instead. That way, on a new request (like a refresh or reload), that message will not be available, it will only ever be displayed once.
    If you absolutely must put it into the session scope, then you can manually remove it once you're done display it so that it won't be available next time.
    It depends on what logic you're employing to display this message but I think the above suggestions should do what you need.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://www.catb.org/~esr/faqs/smart-questions.html
    ----------------------------------------------------------------

  • How to use Session Key-based Request Targeting Mechanism in OCCAS ??

    I read Session Key-Based Request Targeting(chapter 5) in Developing SIP Applications.
    But, I don't work my application using this mechanism.
    I add sesssionKey function with @SipApplicationKey annotation.
    I deploy this application. And then, other machine send INVITE request.
    My application received INVITE request. But sessionKey function is not called before doInvite function is called.
    I used @SipApplicationKey(applicationName="...") annotation.
    It didn't work.
    sample code is following.
    Could someone help me?
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.sip.SipFactory;
    import javax.servlet.sip.SipServlet;
    import javax.servlet.sip.SipServletMessage;
    import javax.servlet.sip.SipServletRequest;
    import javax.servlet.sip.SipServletResponse;
    import javax.servlet.sip.SipURI;
    import javax.servlet.sip.URI;
    import javax.servlet.sip.annotation.SipApplicationKey;
    public class app2SipServlet extends SipServlet {
    private static final long serialVersionUID = 1L;
    public static SipFactory sipFactory;
    public static ServletContext sc;
    public void init(ServletConfig cfg) throws ServletException {
    super.init(cfg);
    sipFactory = getSipFactory();
    sc = getServletContext();
    trace("+++ app2SipServlet Initialization");          
    @SipApplicationKey
    public static String sessionKey(SipServletRequest req) {
    String appid = req.getHeader("ApplicationID");
    System.out.println("application id : " + appid);
    return appid;
    @Override
    public void doRequest(SipServletRequest req)     throws ServletException, IOException {
    trace(req, "doRequest()");
    super.doRequest(req);
    @Override
    protected void doInvite(SipServletRequest req) throws ServletException, IOException {
    URI from = req.getFrom().getURI();
    String user = ((SipURI)from).getUser();
    trace(user + " : " + req.getSession().getApplicationSession().getId());
    trace(user + " : " + req.getSession().getApplicationSession().getApplicationName());
    SipServletResponse resp = req.createResponse(200);
    resp.send();
    trace(resp);
    }

    How many servlets you have defined in your sip.xml .If there are multiple you may want to check if
    -- You have defined main-servlet ?
    -- or Is deployment descriptor version 1.0 or 1.1

Maybe you are looking for

  • Enable Recycle Bin on mapped network drives

    A few years ago I discovered how redirected user profile folders in Windows get Recycle Bin protection, even when the folders are redirected to a network location. This was a huge find for me, and I used this feature to add Recycle Bin coverage to so

  • Issue for integration between GL and AR AP

    Hi All, We have problem with integration real time between GL and AR AP follows: - now system automatic transfer realtime Data from AR or AP module to GL. but my customer don't want transfer automatic realtime because on AR or AP module may enter dat

  • Camera Raw Files Not in Results

    Spotlight seems to ignore my Canon EOS 1DMKII Raw files in it's search results. Are camera raw files supported in Spotlight? Thanks, Scott

  • Can't locate volume in Startup Disk Options...?

    Ok I am sure this is so basic that I have missed something glaringly obvious. I have added a second drive to my G5, created a Mac OS Extended (Journaled) Volume on it, and it's showing up in the finder as a volume. However, I want to use it as the st

  • Groupwise 7.0 sync

    My employer upgraded to Groupwise 7.0 and now I can no longer sync my palm Tungsten E w/ Groupwise PDA connect.  There are no plans to upgrade PDA Connect.  Is there a 3rd party software I can purchase which will work w/ GW 7.0.   Thanks Post relates