Problem in session

hi
i have been facing pbm in retrieving session values in Resin web server
i m using the following code for creating session in the login page
id = "12345";
name = "abc";
session.setAttribute("session_id",id);
session.setAttribute("session_name",name));
here is the code for readiing session in another page
if((String)session.getAttribute("session_id")!=null) { session_id = (String)session.getAttribute("session_id"); }
if((String)session.getAttribute("session_name")!=null) { session_name = (String)session.getAttribute("session_name"); }
the pbm is its working well with tomcat webserver, but when i uploaded this file to another webserver (Resin), the session is not able to read the values
could you please suggest some idea, where i went wrong, i checked all the configuration of the Resin, everything is working fine except the session , i tried and change to cookies, but even its not working with cookies too,
any help in this reagard ll be highly appreciated
thanks

If you loggin using a the same instance of the the browser for example, user A logins into the system a session is created..
If user B then comes and uses the same Browser window as user A and navigates to the login page by the back button etc then tries to login, user B will still be using user A's session,
If however you open a new browser window, you should not get this problem.

Similar Messages

  • Problem with sessions in Kate Editor

    Hey guys!
    I'm using Kate Editor to code and i'm having problems with sessions. If kate is open and I logout KDE, when I come back to KDE all my customizations in Kate's session (activated plugins, font size, etc) are lost.
    If I manually close Kate before logout from KDE, all the customizations are kept when a manually start Kate. I tried a lot of workarounds, but none worked.
    Is this a bug? Someone else with this issue?
    Thanks in advance!

    The Warning errors are simply because you don't have the tablespaces, users, and roles defined in your application system under the DB Admin tab. Unless it is important to you to capture the physical implementation of your tables exactly as well as the table definitions, you can safely ignore these. If the physical implementation IS important to you, then you need to create these tablespaces, roles and users under the database that you created under the DB Admin tab before you start the capture.
    The Error is because in the set of objects you are capturing there is a foreign key that references the table named "PLEASANT". This table must be among the objects that you are capturing, or must already be in a Table Definition in your application system in the repository.

  • Problem with Sessions in JSP

    Hi,
    I am working on a JSP based website, where I am facing problem with sessions. The user is asked to login by providing her id and password. If found correct, a bean is created and populated with all her details and placed in session scope. I plan to use the information stored in the bean on other related pages until she logs out.
    <jsp:useBean id="validUser" scope="session" class="UserBean" >
    <c:set target="${validUser}" property="userId" value="${fn:trim(dbValues.UserId)}" />
    <c:set target="${validUser}" property="userName" value="${fn:trim(dbValues.UserName)}" />
    </jsp:useBean>
    <c:redirect url="userHome.jsp" /> The user is presented her homepage - 'userHome.jsp', where she can find various links, like 'Update Profile', 'Pay Registration Fees', 'Book Room' etc. The information stored in the bean is available on 'userHome.jsp'page.
    <A HREF='userHome.jsp'>Home</A>
    <A HREF='editPersonal.jsp'>Update Profile</A>
    <A HREF='registrationFee.jsp'>Pay Registration Fees</A>
    <A HREF='bookRoom.jsp'>Book Room</A>
    <A HREF='logout.jsp'>Logout</A> The problems are:
    1. Whenever user clicks on any of the above mentioned links and moves to any page, the bean comes out as null.
    <%-- Verify that the user is logged in --%>
    <c:if test="${validUser == null}">
    <jsp:forward page="loginForm.jsp">
    <jsp:param name="origURL" value="${pageContext.request.requestURL}" />
    <jsp:param name="errorMsg" value="You must be logged in to access this site." />
    </jsp:forward>
    </c:if> 2. The URL shows an additional jsessionid, which my client doesn't want to see.
    3. On every click on any link, the value of this jsessionid changes.
    What I presume, when I am clicking on different links, my session changes, and so I am seeing a different jsessionid. And since session is changing, therefore the bean is not available in a different session.
    All this works fine with localhost, problem comes into picture, when I upload my pages to the server.
    Puzzled, can anyone help, where am I going wrong? Let me add here, I am new to JSP and hence don't have much resources with me.

    There are several ways sessions can be exchanged between the browser and the server in a j2ee web application.
    1. The default is through cookies. However when the client does not accept cookies, the server appends the session id to the url.
    2. Some servers also facilitate session information exchange using session id in the url even if the client does accept cookies. This is usually ahieved through a setting in some server configuration file.
    You will have to find out why the server in your application is appending the session id to the url.
    Whatever be the case, the server should be able to look up the session from the incoming request (be it from the session id in the url or a session cookie).
    When session information is exchanged through the JSESSIONID in the url, you should ensure that each and every url that goes to the server has this input parameter. To do that all links and form post urls in your servlet/jsp should be treated with a call to encodeURL().
    For example, in a jsp
       <a href = "<%=response.encodeURL("/nextJsp.jsp")%>">Click here </a>
    or
       <form action = "<%=response.encodeURL("/nextJsp.jsp")%>">
       </form>etc.
    ram.

  • Problem with Sessions, Servlets, Netscape and Solaris

    We are experiencing a problem that is confounding and frustrating us (I have
              a felling that it is something exremely minor that we are overlooking).
              Here goes:
              Context:
              The problem only occurs when using a netscape browser against weblogic
              4.51running on our Solaris 7 box (Everything works fine through IE, and
              through both browsers against our development machines which are on NT)
              Problem:
              We have a bunch of JSP pages and servlets that are used togehter throughout
              our site. They both manage session information for the user. What is
              happening is that there is no problem maintaining session information among
              all the JSP pages, but when we hit a servlet that we use to stream graphs
              back to the browser, it gets the session but it has no contents all of a
              sudden. What seems to be even more strange is that the session is not
              tagged as new (by checking isNew()), it is just empty of the contents that
              were placed it by the JSP pages. Again, this is only occurring from
              Netscape browsers against our Solaris server.
              If anyone can provide any help it would be greatly appreciated. I can
              provide more details if need be.
              Jeremy
              

    There is a property in the weblogic.properties file that lets you set
              the cookie name. If this isn't set, the port will be appended as part of
              the name. I've had a similar problem switching between http and https
              and losing sessions.
              Carles
              Jeremy wrote:
              >
              > in the link tothe servlet the URL had a :80 in it. This was because the url
              > was generated by a JSP page so that when it was moved from server to server
              > and port to port the code wouldn't have to be changed. Unfortuneately,
              > Netscape sucks and takes this to mean that x.x.x.x and x.x.x.x:80 are
              > different and won't acknowledge the cookie from the JSP pages (x.x.x.x) to
              > the servlet (x.x.x.x:80). Thanks fpr your help.
              >
              > Jeremy <[email protected]> wrote in message
              > news:[email protected]...
              > > my mistake, it appears to always happen on port 80 regardless of the
              > server
              > > it is on.
              > >
              > > Jeff Martin <[email protected]> wrote in message
              > > news:[email protected]...
              > > > It really sounds like your servlet is making a new session, even though
              > > > isNew() doesn't say so. What you might try to do is use session.getId()
              > > > to print out the session ID from your jsp pages as well as your servlets
              > > > to determine if it really is a new session.
              > > >
              > > > Do your servlets and JSPs both use the same scheme (http or https) or
              > > > cookie.setSecure()? Do your cookies use domains or paths in either
              > > > servlets or jsps (cookies can be restricted to certain subdirectories
              > > > which might be different between jsps and servlets)? Are you testing
              > > > through a proxy or firewall, or does either browser have different proxy
              > > > settings than the others?
              > > >
              > > > Jeff
              > > >
              > > > Jeremy wrote:
              > > > >
              > > > > We are experiencing a problem that is confounding and frustrating us
              > (I
              > > have
              > > > > a felling that it is something exremely minor that we are
              > overlooking).
              > > > > Here goes:
              > > > >
              > > > > Context:
              > > > > The problem only occurs when using a netscape browser against weblogic
              > > > > 4.51running on our Solaris 7 box (Everything works fine through IE,
              > and
              > > > > through both browsers against our development machines which are on
              > NT)
              > > > >
              > > > > Problem:
              > > > > We have a bunch of JSP pages and servlets that are used togehter
              > > throughout
              > > > > our site. They both manage session information for the user. What is
              > > > > happening is that there is no problem maintaining session information
              > > among
              > > > > all the JSP pages, but when we hit a servlet that we use to stream
              > > graphs
              > > > > back to the browser, it gets the session but it has no contents all of
              > a
              > > > > sudden. What seems to be even more strange is that the session is not
              > > > > tagged as new (by checking isNew()), it is just empty of the contents
              > > that
              > > > > were placed it by the JSP pages. Again, this is only occurring from
              > > > > Netscape browsers against our Solaris server.
              > > > >
              > > > > If anyone can provide any help it would be greatly appreciated. I can
              > > > > provide more details if need be.
              > > > >
              > > > > Jeremy
              > >
              > >
              

  • Problem removing session attributes

    I have a problem removing session attributes
    I try w/ mysession.removeAttribute("key");
    but it still lives in memory. I've tried setAttribute("key", null) as the API states that will do the same thing, but it doesn't work.
    I can get mysession.invalidate() to work, but I want to keep some of the attributes there, while removing another.
    I get no exceptions and no errors.
    Help.
    Running Tomcat 4
    jre 1.3.1

    Actually,
    response.addHeader("Expires", "-1");should be enough.
    The browser should then contact the Web server for updates to that page via a conditional If-Modified-Since request. You don't want a cache disabling 'overkill', since you'd still want the page to remain in the disk cache and used in appropriate situations without contacting the remote Web server, such as when the BACK and FORWARD buttons are pressed...
    Anyway, try this first, and if it doesn't solve your problem, add the other cache-disabling headers, as outlined in the previous post.
    If you're using JSP, verify also that your page has
    <%@ page session="true"%>

  • Screen Resolution Problem in Session Method

    Hi
    I want to use session method in BDC. How to resolve screen resolution problem in Session Method?
    Please give me the code or steps regarding this.
    Thanks & Regards
    venkateswararao

    Hi
    U can only run the session with the option Dynpro Standard Size setted.
    In this way the system should be use the same resolution for every situation.
    Max

  • Order Version problem in session

    Following error is getting displayed while udpating the order:
    Saving order 804880053 failed because doing so would result in data being overwritten. Order data for your browser window was out of date. Please re-submit your changes for them to take effect.
    My order is getting update in CSC and after that again I'm updating my order in StoreSite, in that perticular scenario only this error is coming.
    I have also used below code before updating the order in store site:
    itemDesImpl = (ItemDescriptorImpl)rep.getItemDescriptor("order");
    itemDesImpl.removeItemFromCache(orderId);
    and
    oImpl.invalidateOrder();
    but It only removes cache data not session data and I think the problem is due to session data of order. If I would be able to remove order from session also, I guess I'm done with that error.
    As per my understanding below places order data exists:
    1. Session
    2. Cache
    3. Database
    Please help me out!

    Hai,
    I'm using VS2010 and SQL Server 2005.
    I have a problem in Session state.
    See below is my code,
    //View.aspx.cs
    //Here I assign a textbox value to session
    protected void btnEdit_Click(object sender, EventArgs e)
            Session["rollno"] = txtRollNo.Text;
                Response.Redirect("Edit.aspx");
    //Edit.aspx.cs
    //Here I assign a session value to textbox, which is stored in last page.
    protected void Page_Load(object sender, EventArgs e)
            txtRollNo.Enabled = false;
            txtRollNo.Text = Session["rollno"].ToString();
            getdata();
    public void getdata()
            SqlConnection con = new SqlConnection("Data Source=SERVICETEAM-PC;Initial Catalog=csc;User ID=sa;Password=kavi");
            con.Open();
            SqlCommand cmd = new SqlCommand("Select * from Csc where Roll_No='" + txtRollNo.Text + "'", con);
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read())
                txtName.Text = dr.GetString(1).ToString();
                txtAddress.Text = dr.GetString(2).ToString();
                txtMobileNo.Text = dr.GetString(3).ToString();
                txtYesNo.Text = dr.GetString(4).ToString();
    From the above code If I the Edit button, It will show an error like 
           

  • Problem in Session Communication Express

    Dear All,
    We are using Communication Express for Two uses in our application..
    1.The one is for View Mail...There my app Users will See ..all the tabs Mail,Calendar,Address Book & Options..I enabled this by..referring URL http://....../uwc
    2.Another one is for them to view their calendar activities ..for that we are enabling calendar tab of Comm Express and I can get the calendar... by referring URL http://....../uwc?calid=admin:course14 like that.,
    The Problem Im facing is ,If the User First checks his Mail..and then calendar means my User calendar displays all the Comm tabs..(I need to get Only the Calendar tab here)
    Or else.., If the User checks the Calendar first and then Mail ..means ..the Mail box (here Comm Expp) only displays the calendar tab..(I need to get all the tabs here)
    We enabled SSO ... the problem clearly points Session.,, Is Any Suggestions..
    Thanks In Advance
    Ashik

    Hi..
    Thanks for the explain..
    ./imsimta version
    Sun Java(tm) System Messaging Server 6.2-3.04 (built Jul 15 2005)
    libimta.so 6.2-3.04 (built 01:30:02, Jul 15 2005)
    Linux nile.jlcc.com 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 athlon i386 GNU/Linux
    and you asked about the problem Im facing..
    The Sceniro is ...
    We need to display Calendar & also Mail for our Users in two Separate Links...both links are in two different pages..
    for the Mail Link Im getting Comm Express by., referring URL
    http://myserver/uwc (Here I need all the tabs, and Im getting)
    for the Calendar ., Im creating Calendars for every User..and I need to show only the Calendar..presented in the Comm Expp..(When my user wants to see his Calendar)
    im getting this by Like.....http://....../uwc?calid=admin:course14
    The Problem is When a User First views his ...calendar he will get...but after that he not able to get mail...there its showing only the calendar for the URL..http://.../uwc
    or else...Say..He first View his Mail ...he is getting Comm Expp ...but after that he is not able to get Calendar...there it is showing only the Comm expp for the URL http://.../uwc?calid=admin:course14
    how to solve this...is any problem in Session.
    Or you can help me in another way..
    How to enforce access to Calendar tab in comm expp..
    I tried with ....http://myserver/uwc/index.jsp?gotoUri=/base/UWCMain?calid=admin:course3
    but im gettingblank page for this..
    Thanks
    Ashik

  • Problem In Session State

    Hai, I'm Using VS2010 and SQL Server 2005.
    I have a problem in Session state;
    //View.aspx.cs
    // In this page just I store a textbox into a session variable.
    protected void btnEdit_Click(object sender, EventArgs e)
            Session["rollno"] = txtRollNo.Text;
                Response.Redirect("Edit.aspx");
    //Edit.aspx.cs
    //In this page I retrieve the session value which is stored in previous page
           protected void Page_Load(object sender, EventArgs e)
            txtRollNo.Enabled = false;
            if (!IsPostBack)
                txtRollNo.Text = Session["rollno"].ToString();
                getdata();
     public void getdata()
            SqlConnection con = new SqlConnection("Data Source=SERVICETEAM-PC;Initial Catalog=csc;User ID=sa;Password=kavi");
            con.Open();
            SqlCommand cmd = new SqlCommand("Select * from Csc where Roll_No='" + txtRollNo.Text + "'", con);
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read())
                txtName.Text = dr.GetString(1).ToString();
                txtAddress.Text = dr.GetString(2).ToString();
                txtMobileNo.Text = dr.GetString(3).ToString();
                txtYesNo.Text = dr.GetString(4).ToString();
    From the above code, I got an error when I press Edit button in View.aspx page.
    The Error is
    Description: An unhandled
    exception occurred during the execution of the current web
    request. Please review the stack trace for more information about the error and where it originated in the code. 
    Exception Details: System.Web.HttpException: A page can have only one server-side Form
    tag.
    Source Error: 
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack
    trace below.
    Help Me.....

    Hai,
    I'm using VS2010 and SQL Server 2005.
    I have a problem in Session state.
    See below is my code,
    //View.aspx.cs
    //Here I assign a textbox value to session
    protected void btnEdit_Click(object sender, EventArgs e)
            Session["rollno"] = txtRollNo.Text;
                Response.Redirect("Edit.aspx");
    //Edit.aspx.cs
    //Here I assign a session value to textbox, which is stored in last page.
    protected void Page_Load(object sender, EventArgs e)
            txtRollNo.Enabled = false;
            txtRollNo.Text = Session["rollno"].ToString();
            getdata();
    public void getdata()
            SqlConnection con = new SqlConnection("Data Source=SERVICETEAM-PC;Initial Catalog=csc;User ID=sa;Password=kavi");
            con.Open();
            SqlCommand cmd = new SqlCommand("Select * from Csc where Roll_No='" + txtRollNo.Text + "'", con);
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read())
                txtName.Text = dr.GetString(1).ToString();
                txtAddress.Text = dr.GetString(2).ToString();
                txtMobileNo.Text = dr.GetString(3).ToString();
                txtYesNo.Text = dr.GetString(4).ToString();
    From the above code If I the Edit button, It will show an error like 
           

  • I have a problem with session manager session files because of the invalid json storage data submited by firefox

    Hi, i have problem with session manager's session files. The problem is: the submitted storage data from firefox which is put between "storage":{ and its matching closing brace } But in some of my session files there is non equal { and } under storage's braces. I need to get storage data but in my case it is very hard to do. My question is there any char put before or after { and } like /{ or \{ to avoid confusion? If there is not such thing, i think there could be different solution but i am not sure: i look couple of my session files; after "storage":{...} there is ,_"formDataSaved" so i can get storage data in this example ... by looking between "storage":{ and ,"_formDataSaved" easily. Is there every time ,"_formDataSaved" after "storage":{ ?  Thank you.

    Well, it seems waiting is not my strong suit..! I renamed a javascript file called recovery to sessionstore. This file was in the folder sessionstore-backups I had copied from mozilla 3 days ago, when my tabs were still in place. I replaced the sessionstore in mozilla's default folder with the renamed file and then started mozilla. And the tabs reappeared as they were 3 days ago!
    So there goes the tab problem. But again when I started mozilla the window saying "a script has stopped responding" appeared, this time the script being: chrome//browser/contenttabbrowser.xml2542
    If someone knows how to fix this and make firefox launch normally, please reply! Thank you

  • LR 4 RC2 ...vexing problem, 3 sessions with support and still not able to find? With all settings re

    LR 4 RC2 ...vexing problem, 3 sessions with support and still not able to find? With all settings reset and running a test catalog a raw image when opened in develop will when imediately going back to library view show a significant color shift in red, orange and purple but only in images with significant content in those colors. at first the culprit appeared to be camera calibration default but not reproducable. The problem exists even when opening older images from months ago?  Also if second screen running in loupe mode the image is not shifted.
    Any ideas please
    Dave

    Jim01403, Geoff and others...I'm new here so I'll need a little time The thread is very interesting, populated by serious mature people, how refreshing! It clearly is part of what i'm experiencing and is answered answered here...thank you. My main problem is still the significant color shift between develope and library modules. I'll attach one from each so you and others can see. Unfortunately the library version is the bad one so printing is now very problematic...Note, this occurs in either single or with second monitor on the library version is displayed. I have reset virtually everything and wonder if a cache is not updating or color space is not matching? A symptom/detail worth noting, when switching to library mode, the correct image is displayed for about a second then it jumps to what you see in the examples. As if the library module starts to rendering from develope settings then jumps tback to the original inedited preview??
    Maybe just go back to 3.6 and tread water till 4.1 is fixed?
    Dave

  • Problem with Sessions and window.open

    Hi,
    Hi everyone,
    Help Please!!!
    I am working with Sevlet session objects and HTML forms and windows. I have an HTML form for the user to supply a username and password. Once the user clicks submit I need to open another browser window that has no toolbar, no location, no status bar, etc. The user should also be able to go back to that login screen and login again and open a 2nd, 3rd, etc. instance of the application. My problem is that each application is being asigned the same sessionId. I believe it is being asigned to the main login window and thus to the other child windows it opens. Is there a way to work around this? Do I need to make the user open another browser window to login? I need to be able to let the user open multiple instances of the application with unique session ids for each.
    Any insight is GREATLY appreciated on this topic. Anything you can tell me about sessions (Java), IE, window.open would help greatly!
    THANK YOU IN ADVANCE!!!
    MA

    To achieve this, you must introduce another level of
    abstraction to the Servlet specifications. When you
    work with JSP/Servlets you use mostly the HttpSession
    to handle user related tasks, and the aplication
    context, for things that are common to all users. But
    inside the HttpSession scope, you want to create
    containers that have 'smaller' scope and are uniquely
    identified.
    A ipothetical scenario :Let's say that you must have
    multiple connections to several databases, on each
    database user rights beeing diferrent, and you must be
    able to track user actions globaly, and eventualy
    capture a 'Close Application event' and close all db.
    connections.
    1. when the user first accesses the login frame create
    the HttpSession. In the HttpSession object, store a
    Hastable (let's call it 'ConnectionTable'). Each
    object in the Hashtable must identify uniqely a
    database connection. Now, to create unique identifiers
    ids, make the keys in the hashtable java.lang.Long
    objects, created using System.getCurrentTimeMillis().
    This guaranties there will be no possible confusion.
    From each new open window, on each request to the
    server, along with the usefull parameters, send the
    connection identifier. When proccessing the request,
    select the object from the Hastable wich corresponds
    to the ID.
    2. Now, the values in the ConnectionTable, must act as
    the containers that I mentioned in the first
    paragraph. The simplest way to do this is to have
    again a Hashtable derived class to do the job, wich
    exploses methods similar to HttpSession: setAttibute (
    Object key, Object value) and getAttibute ( Object
    key, Object value). This container may use internally
    a Hashtable to store object, and explose only the
    getAttribute and setAttribute methods for clarity. Any
    way, this is a problem of implementation. Let's call
    this class CustomSession.
    Now, a textual activity diagram:
    1 user accesses the main page, you start a new
    HttpSession; In the HttpSession object, store the
    ConnectionTable object.
    2. the user enters the userID and pwd and adatabase
    name, and a new window is opened. Let's supose the
    data entered is valid.
    3. when you process the login data, you create a new
    CustomSession object. you put in it whatever you would
    put in your HttpSession. You generate a unique
    identifier using System.CurrentTimeMillis(). Put the
    CustomSession object in the ConnectionTable, using the
    generated id as key. Send the response.
    ..... later on .....
    100. the user asks for a particular action to be
    performed - e.g. a row deletion. The page contains a
    form with text field where the user introduces the
    row number, a submit button and a hidden input with
    the ID.
    101. you process the data. Get the ID from the request
    object, get the ConnectionTable from the session, get
    the CustomSession using the ID as key, do whatever
    your logic was doing, but obtaining the objects from
    the CustomSession instead of HttpSession
    NicNic,
    Very slick idea. I think that it could work and it seems that there would be not security issues because the id that you would store on the client side is the Unique Identifier and not the actual Session Id. Do you forsee any security issues for this implementation?

  • Problem with Sessions & CFID Changing Unexpectedly

    MY SETUP...
    ColdFusion version 8.01 Standard
    Hotfix version hf801-00002.jar 
    Java version 1.6.0_04
    server OS Windows 2008 Enterprise 32bit
    webserver IIS 7.0.6
    database MySql 5.0.67
    THE PROBLEM
    For some visitors, every page on the website gives them a new CFID/CFTOKEN. I tried to narrow it down to a particular browser, but it's happening in every browser. It's only happening for some people. It was happening to me, then it stopped. Not sure what I did to fix it, but it's still happening to others.
    I'm using CFID/CFTOKEN (or more recently, a random number stored in a session.variable) as their temporary ID when they add something to their shopping cart. Problem is, when the CFID or session value changes, the items in their cart are no longer associated with them anymore - their cart appears to be empty at that point.
    For the love of God, what is causing the CFID and Session variables to change on every page? I am storing the client global variables in a MySql table which was setup by CF Administrator and appears to be working properly.
    Lastly, this site has been working fine for years, all of the sudden after some PCI Compliance conformity and CF Patches, this problem arose, so I want to blame it on the patches, but I'm not sure.
    Has anyone else ever had this problem? How did you fix it?

    It can also be (and will always be caused) by any user who's browser (or any part of the connection) does not maintain the cookies.
    If the request does not contain a cookie with currently valid cfid|cftoken and|or cfsessionid values, ColdFusion will generate new ones.  This can be cause by security settings in the browser, OS, firewall, proxy etc.
    This has become an increasingly rare issue in modern Internet computing, but it was a fairly common back in the day when cookies where a new idea.

  • Problem with Sessions in Servlets

    Hi,
    I'm having a problem with sesions with servlets. It seems that if someone logs into my website, which is running on all servlets, while another person is logged on, the second person gets the session of the first person.
    I'm using
    HttpSession session = request.getSession(true);to get the session in each page. The session contains a user object which shows if the user is logged in and what permissions.
    The session should be unique to the client computer right? Or am I jsut screwing this up big time?

    Yes, each client will have their own session. However, you may be testing incorrectly:
    In Firefox, for example, all instances of the application running on the same machine will share the same cookies, therefore the same session, and would be considered one client.
    MS IE will do the same if you use File - New to open a new wondow rather than clicking on the desktop icon.
    If the different clients are using different machines and still getting shared data, then you may be using class-level variables in the servlet, which would not be thread safe and could lead to your problems...
    public class MyServlet extends HttpServlet {
      String data;  //bad
      int moredata; //bad
      public void doGet(...) ... { ... }
    }

  • Problem in session.setAtrribute

    hi,
    read te following code.when i try to run the query using session.getAttribute("rstset") in the another jsp it gives error message saying attribute has no value.database has got the value and the query which is used to set the resultset is also working.guys plz solve this problem. i'm really stuck up at this point.
    import java.sql.*;
    import javax.servlet.http.*;
    public class TSHistory extends actionInt{
         public String executecommand(HttpServletRequest Request,HttpServletResponse Response)
              String s=null;
              Connection conn=DBConnect.getInstance().getConnection();
              String sql="select tsdate,statusName from time_sheet,TS_status where empID=? and TS_status.statusID=time_sheet.status";
              try{
                   PreparedStatement pst=conn.prepareStatement(sql);
                   HttpSession session=Request.getSession();
                   String empID=(String)session.getAttribute("empID");
                   pst.setInt(1,Integer.parseInt(empID));
                   ResultSet rs=pst.executeQuery();
                   session.setAttribute("rstset",rs);
                   rs.close();
                   s="TSHistory";
                   pst.close();
                   conn.close();
              }catch(SQLException e){
                   e.printStackTrace();
              return s;
    }

    Hi Alok,
    From your code, you are putting the ResultSet in session and then closing the connection. In fact a ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results. So, when u call session.getAttribute(..), it should return null, I guess.
    The idea to put the resultset in session can be extended by writing a class, which implements the ResultSet and then setting the class member variables with the returned resultset, and then putting the same in session.

  • Problem with Session variable initialization block

    Hi,
    I'm getting strange results when using session variables in my repository files.
    I have created session variables as specified in the document which is available at
    http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/bi_admin/biadmin.html
    The main problem getting with the system session variable (USER) in the select statement.
    My select statement is as follows,
    select ':USER',case when upper(':USER') = 'KUMAR' then 'APR-05' end from Dual
    The problem is while logging into the BI Answers it is allowing all the invalid users to login who does not exist.
    when i remove the quotes and simply use :USER in the select statement it is not allowing the invalid users to login but giving error while displaying the results.
    when i remove the user variable from select statement its giving correct results.
    Can i know what is causing the problem.
    Thanks,
    Kumar.

    Hi DK,
    Check out my post Rowlevel Security?? and see if it helps you.
    Cheers!
    -Joe

Maybe you are looking for

  • Not Fit for Purpose in the 21st Century

    BT As someone who is on one hand fortunate enough to live in a semi rural area, and also unfortunate enough to live in a semi rural area. I have no other option open to me to use any other network (and I mean network) than BT's. Having to suffer copp

  • My acrobat 9.0 stpped working

    This was a perfectly normal program started giving problem after a trial version of XI was installed as it was not providing any benefit to my Acrobat 9.0 pro. The error is windows generated and interjects when Acrobat is started. The error is "Licen

  • Broken screen cant connect to pc companion

    can someone please help me.screen is broken and need to get my concacts off phone and on to my pc...my phone is connected to the laptop but have to unlock screen on phone,but cant as the screen is broken..please help i sure there must be away around

  • How can i recover a drive that is locked

    i cant unlock my drive. the computer sees it but wont mount it. its a 3t

  • I have *never* seen weblogs work on my Xserve.

    Before I jump ship and go with another solution for content management, I'd like to make one last attempt at getting the weblogs to work on our Xserve running Mac OSX Server 10.4.4. All I get when going to the https://server/weblog/ URL (yes I am usi