Session.putValue() and session.setAttribute

do I have to use session.putValue() before using session.setAttribute() and session.getAttribute() ?
becuase I have one JSP page include one form (action=TheSameJspFile.JSP) several Submit bottuns each Bottun has its Value.
in the JSP I request the submit value and depends on it doing stuff ...
each Value I have to get and to set a session Attribute, if I want to putValue it will delete the old value.
how can I solve this?

You need to store something in the session before you can retrieve it.
So, you need to do a setAttribute() to place something in the session. Then you use getAttribute() to retrieve it. DO NOT use putValue as it is deprecated and has been replaced by setAttribute(). DO NOT use getValue() as it is deprecated and has been replaced by getAttribute().

Similar Messages

  • Session Id, Unified Session ID and session shadowing

    Hi,
    It looks like we've got a problem with session shadowing in our 2012R2 deployment. Trying to shadow a session from server manager returns an error "the session identification does not specify a valid session", but running a command "Mstsc.exe
    /v:RDS2012 /shadow:2 /noConsentPrompt" and using SessionID opens correct session without a problem. I noticed that there are two different ID's for each session, SessionID and UnifiedSessionID which are different. When I'm trying to shadow a Uinified
    one I'm receiving an error, but with SessionID it opens it. I can see that server manager is using UnifiedSessionID and that's why I can't open a shadowing session with GUI.
    Is there a way to sort it out so we will be able to shadow a session from Server Manager?
    Best,
    Marcin

    Hi,
    It looks like we've got a problem with session shadowing in our 2012R2 deployment. Trying to shadow a session from server manager returns an error "the session identification does not specify a valid session", but running a command "Mstsc.exe
    /v:RDS2012 /shadow:2 /noConsentPrompt" and using SessionID opens correct session without a problem. I noticed that there are two different ID's for each session, SessionID and UnifiedSessionID which are different. When I'm trying to shadow a Uinified
    one I'm receiving an error, but with SessionID it opens it. I can see that server manager is using UnifiedSessionID and that's why I can't open a shadowing session with GUI.
    Is there a way to sort it out so we will be able to shadow a session from Server Manager?
    Best,
    Marcin

  • Upload file with iframe loos session user and session id in wwv_flow_files

    Hello every one, hope someone could help us with this problem.
    What we are trying to do is to upload a file from a jquery dialog in a appex page by redirecting the POST action of the wwvFlowForm to the iframe.
    *1. In the javascript there is the function call to open my modal window with the input*
    function add_fichier_form(numeroProjet,idCat){
         $("#div_upload_fichier").dialog(
                    modal : true ,
                    autoOpen : false ,
                    resizable: false ,
                    width: 700         
           $('#div_upload_fichier').parent().appendTo('#div_base');
          $('#upload_button').unbind('click').click(function(){           
              if ($('#P4010_FILE_FICHIER').val() != '') {
                   $('#upload_iframe_v2').unbind('load').load(function () {
                        $('#upload_status').html(' déplacement du fichier...');
                        // move the file
                        $('#upload_status').html('Fichier transféré avec succès');
                        //file transfer ok
                        //calling the javascript function to add everything in my own table;
                                     //we see the file in the  wwv_flow_file_objects$ without
                         add_fichier_form_db();
                   // set the form target to the iframe, submit, then remove the target
                   $('#wwvFlowForm').attr('target','upload_iframe_v2').submit().removeAttr('target');
                   $('#upload_status').html(' Téléchargement du fichier...');
              }else {
                   alert('Veuillez sélectionner un fichier');
         $("#div_upload_fichier").dialog("option", "title", "Ajout d'un fichier");
            $("#div_upload_fichier").dialog("open");
           }*2. At this point we see the file in the table but without the user and session credential*
    select *
        from wwv_flow_file_objects$
    The result is that the field security_group_id is assign to 0 AND created_by = APEX_PUBLIC_USER
    *3. add_fichier_form_db(); the javascript function making the ajax call to a procedure plsql*
    function add_fichier_form_db(){
             //alert ('Dasn fichier form db');
         vNumeroProjet = document.getElementById('P4010_CAT_NUMERO_PROJET').value;
         vIdCat = document.getElementById('P4010_CAT_ID').value;
         vFichierNom = document.getElementById('P4010_NOM_FICHIER').value;
         vFichierDesc = document.getElementById('P4010_DESC_FICHIER').value;
         vFichierFile = document.getElementById('P4010_FILE_FICHIER_NAME').value;
         var ajaxRequest = new htmldb_Get(null , 300, 'APPLICATION_PROCESS=ADD_FICHIER_FORM_DB', 4010);
         ajaxRequest.add( "P4010_CAT_NUMERO_PROJET", vNumeroProjet);
         ajaxRequest.add( "P4010_F_CAT_ID", vIdCat);
         ajaxRequest.add( "P4010_FICHIER_NOM", vFichierNom);
         ajaxRequest.add( "P4010_FICHIER_DESC", vFichierDesc);
         ajaxRequest.add( "P4010_FILE_FICHIER_NAME", vFichierFile);
          var gReturn = ajaxRequest.get();
         if (gReturn){
              $x("getlistfichier").innerHTML = gReturn;
              closeForm();
         }else{
              alert ('Problèmes dans le call Ajax ADD_REPERTOIRE_FORM_DB \n La valeur retournée est: \n' + gReturn);
    }*4. PLSQL PROCEDURE *
    h1. WHEN the query is executing it's return ORA-01403: no data found. WHY ????
    PROCEDURE P_ADD_FICHIER_FORM_DB(
                P_NUMERO_PROJET number,
                P_CAT_ID number,
                P_FICHIER_NOM varchar2,
                P_FICHIER_DESC varchar2,
                P_FILE_FICHIER_NAME in varchar2)
    AS
      vNumeroProjet number;
      vFichierNom varchar(255);
      vFichierDesc varchar(2000);
      vCatId number;
      vActif number;
      vDocSize number;
      vNomUsager varchar(10);
      vDateCreation date;
      vFichierTypeId number;
      vNomReel varchar2(1000);
      vNomReel2 varchar2(1000);
      vCurVal number;
      BEGIN
        SELECT FILENAME,DOC_SIZE,CREATED_ON
        INTO
        vNomReel,vDocSize,vDateCreation
        FROM WWV_FLOW_FILES
        WHERE FILENAME = P_FILE_FICHIER_NAME;
    /*GET ERROR sqlerrm:ORA-01403: no data found */
      END P_ADD_FICHIER_FORM_DB;h4. hope someone help us soon
    Thanks in advance
    jocelyn

    Finally we find what was wrong so i give you the solution.
    In the javascript on the function add_fichier_form
    We need to append the div of the form to the default form of apex wwvFlowForm
    so the line*
    $('#div_upload_fichier').parent().appendTo('#div_base');
    should be change to*
    $('#div_upload_fichier').parent().appendTo('#wwvFlowForm');Edited by: jocbed on 2012-01-26 11:08

  • Session.removeAttribute and session.invalidate

    I pass a scoped object from one JSP #1 to JSP #2 in a session.
    In JSP #1, I did:
           <c:set var="cr" value="${articleForm.creator}" scope="session"/>In JSP #2, I did:
          <bean:define id="author" name="cr" scope="session" type="java.lang.String"/>
          <html:text property="receiver" value="<%=author%>" size="82" maxlength="25" tabindex="1"/>Immediately after I output the value, I want to remove the object from the session. I have two questions:
    1. which one of the following should I do:
           session.removeAttribute( "cr" );or
           session.removerAttribute( "author" );or
           session.removeAttribute( "receiver" );2. Do I have to invalidate the session; i.e. session.invalidate(); after all the objects in the session are removed?

    I pass a scoped object from one JSP #1 to JSP #2 in a session.
    In JSP #1, I did:
           <c:set var="cr" value="${articleForm.creator}" scope="session"/>In JSP #2, I did:
          <bean:define id="author" name="cr" scope="session" type="java.lang.String"/>      <html:text property="receiver" value="<%=author%>" size="82" maxlength="25" tabindex="1"/>Immediately after I output the value, I want to remove the object from the session. Which one of the following should I do:
           session.removeAttribute( "cr" );or
           session.removerAttribute( "author" );or
           session.removeAttribute( "receiver" );

  • Session timeout and session.invalidate() -- are they the same?

    I was just wondering when a session timeout occurs (either by setting the session-timeout in web.xml or the server's default timeout), is the session automatically invalidated? Or should we call setMaxInactiveInterval() instead? Or is calling session.invalidate() the only way to invalidate a session?

    Hello all,
    Both are same in terms of functionality, but if you use both of them like
    1: You specified the tag sessionTimeout and
    2: in your program the session.maxInactiveIntervalTime( value ) here if the value is(we gave it in terms of seconds like for 40 minutes we give 2400) then the program code will override the value previously set in web.xml
    Thanks
    Prabhakar

  • Session Replication and Session Timeout -- Urgent

    WLS -4.5.1 SP 11
              OS - both NT and Sol
              HI All
              The session does not seems to timeout when running the Weblogic servers in
              clustered mode with in-memory session replication on.
              This problem seems to be there in version5.1 too , as per another post , it
              seems to be solved in WLS5.1 sp 8
              Could anyone pls confirm in which patch in WLS 4.5.1 is the problem
              addressed . I'm using patch 11 and am getting the problem.
              Thanks in advance..
              -Surya
              

    Try SP13 and if the problem persists, contact [email protected]
              -K
              Surya B Maithani wrote:
              > WLS -4.5.1 SP 11
              > OS - both NT and Sol
              >
              > HI All
              >
              > The session does not seems to timeout when running the Weblogic servers in
              > clustered mode with in-memory session replication on.
              > This problem seems to be there in version5.1 too , as per another post , it
              > seems to be solved in WLS5.1 sp 8
              >
              > Could anyone pls confirm in which patch in WLS 4.5.1 is the problem
              > addressed . I'm using patch 11 and am getting the problem.
              >
              > Thanks in advance..
              >
              > -Surya
              

  • What is the difference between Session timeout and Short Session timeout Under Excel Service Application -- session management?

    Under Excel Service Application --> session management; what is the difference between Session timeout and Short Session timeout?

    Any call made from the API will automatically be set to the “Session Timeout” period, no matter
    what. Calls made from EWA (Excel Web Access) will get the “Short Session Timeout” period assigned to it initially.
    Short Session Timeout and Session Timeout in Excel Services
    Short Session Timeout and Session Timeout in Excel Services - Part 2
    Sessions and session time-outs in Excel Services
    above links are from old version but still applies to all.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Session/jstl  and load balancing - need expert advice

    After user loggs in, I am getting locale from db and storing it inside userSession along with userLogin. Inside jsp using <fmt> tag to display locale based resource property.
    HttpSession userSession = request.getSession(true);
    userSession.setAttribute("UserLogin", oRS.getString("user_login"));
    Config.set(userSession, Config.FMT_LOCALE, currentLocale);Also using filter after login page to check for User Session. Currently all working fine .
    But if i want to make use of load balancing, whether still it will work?
    1)I understand that if i depend on network config i.e. session request sticks to one server then i believe shld not be a problem
    2)But if that is not the choice then what else ? Client want to make use of serialization technique. I do not know much about it, how to implement it, any sample is greatly appreciated.
    3)what about jstl Config.set(..) whether any changes needed here?
    4)Do i need to change filter code.
    Pls pls help me, i really need expert advice on this.
    regards
    Manisha

    1)If i want cluster server to replicate the session
    then all attributes saved in the session have to be
    serializable.yes.
    2)In docs it is mentioned
    Use setAttribute to Change Session State
    In an HTTP servlet that implements
    javax.servlet.http.HttpSession, use
    HttpSession.setAttribute (which replaces the
    deprecated putValue) to change attributes in a
    session object. If you set attributes in a session
    object with setAttribute, the object and its
    attributes are replicated in a cluster using
    in-memory replication. If you use other set methods
    to change objects within a session, WebLogic Server
    does not replicate those changes. Every time a change
    is made to an object that is in the session,
    setAttribute() should be called to update that object
    across the cluster.
    Whether it means that if I want to store a object
    (which is serializable) e.g. 'String' inside session
    and use setAttribute() method then I do not need to
    make that object implicitly serializable?No, you still need the objects to be serializable.

  • Session Login and Logout in jsp page

    hi
    i am developing jsp page
    i completed except logout.jsp page
    my login page is in Jsp format and then business Logic in servlet and then get method & set method in bean.java
    i have login and then it sucess page there i have singout button
    if i sign out it should go to login page
    how to do
    how to make session invalidate
    how to get session id
    i have one more doubt i should check session invalidate each jsp page
    regarding session login and logout in jsp
    if anybody knows please give me a piece of code regarding login and logout
    Regards
    Akshatha

    This is part of your filter class now you need login.jsp page
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="Stylesheet" type="text/css" href="/PAS/css/site.css"/>
        <title>Automation System | Login Page</title>
    </head>
    <body>
    <div align="center">
        <h1>Photint Automation System</h1>
    </div>
    <br/><br/><br/>
    <center>
        <table border="1" cellpadding="0" cellspacing="0" width="40%" bgcolor="FFFFFFFF">
            <thead>
                <tr>
                    <th align="left" height="30"> <h3>    Login</h3></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <div align="center">
                            <form name="LOGIN" action="/PAS/LoginServlet" method="POST">
                                <table border="0">
                                    <tbody>
                                        <tr>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                        </tr>
                                        <tr>
                                            <td height="30"></td>
                                            <td align="right" height="30">User Name : </td>
                                            <td align="left"  height="30"><input type="text" name="USERNAME" value="" size="35"  /></td>
                                            <td height="30"></td>
                                        </tr>
                                        <tr>
                                            <td height="30"></td>
                                            <td align="right" height="30">Password : </td>
                                            <td align="left"  height="30"><input type="password" name="PASSWORD" value="" size="35"  /></td>
                                            <td height="30"></td>
                                        </tr>
                                        <tr>
                                            <td height="50"></td>
                                            <td height="50"></td>
                                            <td align="center" height="50"><input type="submit" value="Login" name="Login" />  <input type="reset" value="Reset" name="Reset" /></td>
                                            <td height="50"></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </form>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </center>
    <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
    <br/><br/><br/>
    <center>Copyright &copy; 2009 Photint FZ LLC</center>
    <center>Powered by Ali Jamali</center>
    <center>Version : 1.0</center>
    </body>
    </html>And you need loginServlet.java
    package com.ali.util.filter;
    import com.ali.entity.user.UserEntity;
    import com.ali.util.HibernateUtil;
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class LoginServlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
        protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            String username = request.getParameter("USERNAME");
            String password = request.getParameter("PASSWORD");
            if (username == null || username.length() == 0) {
                System.err.println(" Username textfeild is empty ..... !");
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            if (UserRegistry.isUserLoggedIn(username)) {
                System.out.printf("User [%s] is already logged in. \n", username);
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            UserEntity user = null;
            try {
                user = (UserEntity) HibernateUtil.load(UserEntity.class, username);
                if (user == null || !user.getPassword().equals(password)) {
                    RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                    dispatcher.forward(request, response);
                    System.err.println(" Password or username is not valid ..... !");
                    return;
            } catch (Exception e) {
                e.printStackTrace();
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            HttpSession session = request.getSession();
            System.err.println(request.getRemoteAddr());
            session.setAttribute("username", user.getFirstName());
            session.setAttribute("userType", user.isAdmin());
            UserRegistry.logInUser(username);
            response.sendRedirect("/PAS/index.jsp");
    }finally is you need to just one user can be online at time or need to know how many user & who is online you should at this class also
    package com.ali.util.filter;
    import java.util.ArrayList;
    import java.util.List;
    public class UserRegistry {
        private static final List loggedInUsers = new ArrayList();
        public static void logInUser(String username) {
            loggedInUsers.add(username);
        public static void logoutUser(String username) {
            if (isUserLoggedIn(username)) {
                loggedInUsers.remove(username);
        public static boolean isUserLoggedIn(String username) {
            return loggedInUsers.contains(username);
    }If you have any more Q. or any comment , Most welcome
    Thanks
    Ali Jamali

  • Session migration and replication

    Hi All,
    I am having a hard time in configuring my application for HTTP session migration. Our weblogic server consists of two managed servers running in same cluster. Each server has an Ehcache that stores some information of user with key as session ID and value as info object. In case, if a server needs restart, we would want to take this updated info Object from cache residing on server being restarted to another managed server within the same cluster.
    I browsed through many documentations online. Most of them explained about session replication but not migration. so I followed replication (I don't want a real time sync up of HTTP session. I want it to migrate if something goes wrong with one of the managed server).
    However, I could not achieve this task after following the steps to configure this feature. I would appreciate a lot if someone can help me figuring out the issue here.
    Here is what I did.
    1) Weblogic.xml
         <session-descriptor>
    <persistent-store-type>replicated_if_clustered</persistent-store-type>
    </session-descriptor>
    2) An implementation class of HttpSessionActivationListener, HttpSessionListener, HttSessionAttributeListener:
    public void sessionDidActivate(HttpSessionEvent sessionEvent) {
    // NEVER GETS CALLED
    over here i would check if session has any attribute with name 'CACHE_ELEMENT'. If yes, then it is a migration case for current managed server
              Log.info(UserCacheMigrationListener.class, "inside sessionDidActivate");//
    public void sessionWillPassivate(HttpSessionEvent sessionEvent) {
    // NEVER GETS CALLED
    Over here I would set attribute 'CACHE_ELEMENT' so that it is available for target managed server when it's sessionDidActivate is called
              Log.info(UserCacheMigrationListener.class, "inside sessionWillPassivate");
    public void sessionCreated(HttpSessionEvent sessionEvent) {
    THIS GETS CALLED! and I set the following attribute
    sessionEvent.getHttpSession().setAttribute(UserCacheMigrationListener.class.getName(), this);
    public void sessionDestroyed(HttpSessionEvent arg0) {
    THIS GETS CALLED!
    public void valueBound(HttpSessionBindingEvent arg0) {
    THIS GETS CALLED! WHICH MEANS THAT I WAS ABLE TO setAttribute this class's instance in sessionCreatedMethod
    In the above code, the setAttribute method used inside the sessionCreated(..) method successfully sets the attribute to this session. This is apparent because valueBound(..) method is called when session is created. But why does it not call the sessionWillActivate method???
    3.) An entry in web.xml for this listener.
         <listener>
              <listener-class>com.xyz.UserCacheMigrationListener</listener-class>
         </listener>
    4) from weblogic config.xml. I am copying all meaning stuffs from config.xml to describe as much as I can.
    <server>
    <name>AdminServer</name>
    <ssl>
    <enabled>false</enabled>
    </ssl>
    <listen-address>localhost</listen-address>
    <network-access-point>
    <name>AdminChannel</name>
    <protocol>t3</protocol>
    <listen-address>localhost</listen-address>
    <http-enabled-for-this-protocol>true</http-enabled-for-this-protocol>
    <tunneling-enabled>false</tunneling-enabled>
    <outbound-enabled>false</outbound-enabled>
    <enabled>true</enabled>
    <two-way-ssl-enabled>false</two-way-ssl-enabled>
    <client-certificate-enforced>false</client-certificate-enforced>
    </network-access-point>
    <data-source>
    <rmi-jdbc-security xsi:nil="true"></rmi-jdbc-security>
    </data-source>
    </server>
    <server>
    <name>Node1</name>
    <ssl>
    <enabled>false</enabled>
    </ssl>
    <machine>DevMachine</machine>
    <listen-port>7002</listen-port>
    <cluster>DevCluster</cluster>
    <replication-group>devGroup1</replication-group>
    <preferred-secondary-group>devGroup2</preferred-secondary-group>
    <web-server>
    <keep-alive-secs>500</keep-alive-secs>
    <post-timeout-secs>120</post-timeout-secs>
    </web-server>
    <listen-address>localhost</listen-address>
    <jta-migratable-target>
    <user-preferred-server>Node1</user-preferred-server>
    <cluster>DevCluster</cluster>
    </jta-migratable-target>
    <data-source>
    <rmi-jdbc-security xsi:nil="true"></rmi-jdbc-security>
    </data-source>
    </server>
    <server>
    <name>Node2</name>
    <ssl>
    <enabled>false</enabled>
    </ssl>
    <machine>DevMachine</machine>
    <listen-port>7003</listen-port>
    <cluster>DevCluster</cluster>
    <replication-group>devGroup2</replication-group>
    <preferred-secondary-group>devGroup1</preferred-secondary-group>
    <listen-address>localhost</listen-address>
    <network-access-point>
    <name>Node2Channel</name>
    <protocol>t3</protocol>
    <listen-address>localhost</listen-address>
    <http-enabled-for-this-protocol>true</http-enabled-for-this-protocol>
    <tunneling-enabled>true</tunneling-enabled>
    <outbound-enabled>false</outbound-enabled>
    <enabled>true</enabled>
    <two-way-ssl-enabled>false</two-way-ssl-enabled>
    <client-certificate-enforced>false</client-certificate-enforced>
    </network-access-point>
    <jta-migratable-target>
    <user-preferred-server>Node2</user-preferred-server>
    <cluster>DevCluster</cluster>
    </jta-migratable-target>
    <data-source>
    <rmi-jdbc-security xsi:nil="true"></rmi-jdbc-security>
    </data-source>
    </server>
    <cluster>
    <name>DevCluster</name>
    <cluster-messaging-mode>unicast</cluster-messaging-mode>
    </cluster>
    <machine>
    <name>DevMachine</name>
    <node-manager>
    <nm-type>Plain</nm-type>
    </node-manager>
    </machine>
    <migratable-target>
    <name>Node1 (migratable)</name>
    <notes>This is a system generated default migratable target for a server. Do not delete manually.</notes>
    <user-preferred-server>Node1</user-preferred-server>
    <cluster>DevCluster</cluster>
    </migratable-target>
    <migratable-target>
    <name>Node2 (migratable)</name>
    <notes>This is a system generated default migratable target for a server. Do not delete manually.</notes>
    <user-preferred-server>Node2</user-preferred-server>
    <cluster>DevCluster</cluster>
    </migratable-target>
    ------------------------------------------------------------------------------------------------------------------

    Hi,
    So you want to migrate your server to server.
    Here are the following links which help you.
    http://docs.oracle.com/cd/E15051_01/wls/docs103/cluster/migration.html
    http://www.oracle.com/technetwork/middleware/weblogic/messaging/wlasm-1853193.pdf
    let me know the status if you need any further help on this issue.
    Regards,
    Kal

  • Session: Waiting and Working Chart

    I am using OEM 10g (Grid control) to monitor my database.
    But I don know what does the Y axis on the chart (Session: Waiting and Working) mean ?
    Thanks for your help.
    Note: Click Home page -> Database -> Performance -> Sessions: Waiting and Working.

    2 store the user name in the session to display as a welcome message to the user when they are logged in.]
    in class where you match the username and password .if given user is exist in records then set it into session
    HttpSession session =request.getSession();
    session.setAttribute("",);
    3 tell the user they dont exist in the database or that there password is wrong and give them the option to either A) reset the password or B) create a user
    in same class if user does not exist the redirect the request to different pages in that pages you put these two like A) reset the password or B) create a user

  • "Accounting-Start" and "Accounting-Stop" with same "user name" and "session Id" recorded in different RADIUS servers.

    Hi,
    I have questions about "Accounting-Start" and "Accounting-Stop".
    1.If a NAS configured to have a primary and a backup RADIUS server. To start with all the “Accounting-Start” records will be in the primary RADIUS server. Later on the primary server goes down (Primary server won’t tell the NAS?). When sessions stop, the NAS sends the “Accounting-Stop” to the secondary. I understand the “Start-Stop” record with the same “user name” and “session-id” ideally should be recorded in the same server. If this situation happens what should both the NAS and RADIUS server do?
    2.A NAS configured to have a primary and backup RADIUS server. To start with all the “Accounting-Start” records will be in the primary RADIUS server. Later on the administrator decided to change the primary server (as there are problems with the previous primary). sessions stop, the NAS sends the “Accounting-Stop” to the new primary. This ends up the “Accounting-Start” and “Accounting-Stop” with the same “user name” and “session Id” in two RADIUS servers.
    To summarize, how to avoid the ”start-stop” pair ends up in different servers ? If it does, is it  an issue for RADIUS application ?
    Cheers,
    1.If a NAS configured to have a primary and a backup RADIUS server. To start with all the “Accounting-Start” records will be in the primary RADIUS server. Later on the primary server goes down (Primary server won’t tell the NAS?). When sessions stop, the NAS sends the “Accounting-Stop” to the secondary. I understand the “Start-Stop” record with the same “user name” and “session-id” ideally should be recorded in the same server. If this situation happens what should both the NAS and RADIUS server do?
    2.A NAS configured to have a primary and backup RADIUS server. To start with all the “Accounting-Start” records will be in the primary RADIUS server. Later on the administrator decided to change the primary server (as there are problems with the previous primary). sessions stop, the NAS sends the “Accounting-Stop” to the new primary. This ends up the “Accounting-Start” and “Accounting-Stop” with the same “user name” and “session Id” in two RADIUS servers.
    To summarize, how to avoid the ”start-stop” pair ends up in different servers ? If it does, is it  an issue for RADIUS application ?
    Cheers,

    vignesh and BalusC,
    following is the code in front controller's doFilter method. is this not thread safe?
            HttpServletRequest req = (HttpServletRequest) request;
            HttpServletResponse res = (HttpServletResponse) response;
            HttpSession session = req.getSession();
            somepackage.User user;
            if(session.getAttribute("user") == null){
                user = new somepackage.User();
                session.setAttribute("user", user);
            }else{           
                user = (somepackage.User) session.getAttribute("user");
            }user object maintains all information about a user. if it is in session scope, everything should work fine.
    another observation is after some time of usage, both people in different systems are getting same session.getId()
    in my logout page i am using
    session.invalidate();
    thanks,
    moses

  • Server hangs and session variable value not maintained.

    dear all,
    this is exteremetly urgent. i upgraded my tomcat to 4.1.24.but i have problems running the same code which was working earlier, i get null in the value of session variable. and also get the following error
    ////////////////error got /////////////
    Compile failed; see the compiler error output for details.
    at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:842)
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
    at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:317)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext
    .java:473)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:190)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
    95)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
    2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
    rValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:22
    3)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
    ssConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
    :565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:619)
    at java.lang.Thread.run(Thread.java:536)
    ///////////////end of error messsge ////////////
    the code where i am getting this message is as follows
    <%@ page session="true"%>
    <HTML>
    <HEAD><TITLE> LOGGED IN ok</TITLE> </HEAD>
    <%@ page import="java.sql.*" %>
    <%! // declaring variables
    String s = "";
    java.sql.ResultSet rs=null;
    java.sql.Connection con;
    java.sql.Statement stmt=null,stmt1=null;
    String username = "";
    String password = "";
    String Ousername = "";
    String Opassword = "";
    String changepass="";
    String usertype ="",useremail="",EmpName="";
    %>
    <body>
         <%      
         try
         //set session for max of 100 milliseconds
         // session.setMaxInactiveInterval(10000);
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con = java.sql.DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};" +"DBQ=c:/vishal/HelpDesk.mdb;DriverID=22;READONLY=false","","");
              stmt = con.createStatement();
              s = "select * from LoginUser";     
         username = request.getParameter("LogonId"); //get this through prev. form
         password = request.getParameter("txtPassword");
         out.println(username + " " + password);
         // make explicitly to lower case
         username = username.toLowerCase();
         rs = stmt.executeQuery(s);               
                        while(rs.next())
                        //getting data from database
                        Ousername = rs.getString("EmpName");
                        Opassword = rs.getString("Password");
                        useremail = rs.getString("EmailId");
                        usertype = rs.getString("UserType");     
                        if(Opassword.equals(password) && Ousername.equals(username)) //found match correct entry
                             changepass = request.getParameter("PasswordNew");
                             if(changepass != null)
                             stmt1 = con.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_UPDATABLE);     
                             s = "update LoginUser set Password = '" + changepass + "' where EmpName = '" + username +"'";
                             out.println(s);
                             stmt1.executeUpdate(s);
                             stmt1.close();
                             if(usertype.equals("User") == false)//ie admin
                             session.setAttribute("username",username);     
    ************************this value not maintained *********************
                             session.setAttribute("useremail",useremail);
                             session.setAttribute("usertype",usertype);
    ************************this value not maintained *********************
                             //closing connections
                             %>                                                       
                                  <jsp:forward page= "ComplaintType.jsp" />                         
                             <%
                             else //user
                             EmpName = username;
                             session.setAttribute("EmpName",EmpName);                         
                             session.setAttribute("useremail",useremail);
                             //closing connections
                             %>
                             <jsp:forward page="ComplaintCategory.jsp" />
                             <%     
                             }//end if
                        }//while loop                                   
                        //first closing connections then forwarding                    
         %>
                        <jsp:forward page="InvalidLOGIN.jsp" />
                        <%     
                        ///rs.close();
                        ////closing
                        //stmt.close();
         // con.close();
         }//try
              catch(Exception ep)
              out.println(ep);
              System.exit(1);
         %>
    </BODY>
    </HTML>

    hi all,
    thanx a lot for your help,specially hari52
    hari52 strangely enough the code started working,but
    now i have another problem
    after a while my server hangs or gets shutdown ,a
    message is shown as
    "java.exe has generated error and will be shutdown"
    i know that more connections can be a prob. but i
    make sure that connections r closed on each page,also
    i am a newbie and do not have the time at present to
    learn abt. connection pool ,can this problem be
    solved easily?
    it would be a great help again on your part,
    thanx again,You remove the System.exit(1) line from the code inside the catch block
    and try again. That's the reason tomcat getting down. System.exit(1) should not be used inside jsp. it will make the underlaying Servlet Engine to shutdown.

  • Oracle portal and session tracking

    Friend I am working in JDeveloper in my PC and my statements in with setAttribute and getAttribute does work ,but the same statement doesn't work when I use this jsp as my portlet.The error is given below.So portal doesnot support this method's ?
    Method getAttribute(java.lang.String) not found in interface javax.servlet.http.HttpSession.
    OConnect = (Connect)Session.getAttribute("OConnect");
    Method getAttribute(java.lang.String) not found in interface javax.servlet.http.HttpSession.
    OMainMenu = (MainMenu)Session.getAttribute("OMainMenu");
    Method setAttribute(java.lang.String, ccrspackage.Connect) not found in interface javax.servlet.http.HttpSession.
    Session.setAttribute("OConnect",OConnect);
    Method setAttribute(java.lang.String, ccrspackage.MainMenu) not found in interface javax.servlet.http.HttpSession.
    Session.setAttribute("OMainMenu",OMainMenu);
    please help
    Note : below is my jsp code as it is.
    **************my jsp code**************
    <%@ page contentType="text/html;charset=WINDOWS-1252"%>
    <%@page import = "oracle.portal.provider.v1.*, oracle.portal.provider.v1.http.*, oracle.portal.utils.v1.*, java.sql.*, ccrspackage.*" %>
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1252">
    <META NAME="GENERATOR" CONTENT="Oracle JDeveloper">
    <TITLE>
    CCRS Application
    </TITLE>
    </HEAD>
    <BODY BGCOLOR = #FFCC00 FONT SIZE = "+2" >
    <FORM NAME="CCRSMenu " action="CCRSMenu.jsp" METHOD="POST" target ="NewWindow">
    <%
    //create session for connection
    HttpSession Session = request.getSession(true);
    //set the connection to the database variable null
    Connect OConnect = null;
    MainMenu OMainMenu = null;
    if (request.getMethod().equals("POST"))
    OConnect = (Connect)Session.getAttribute("OConnect");
    OMainMenu = (MainMenu)Session.getAttribute("OMainMenu");
    //throws the page returned by the method
    String LoadJsp = OMainMenu.ReturnLoadJsp(request);
    response.sendRedirect(LoadJsp);
    else
    OConnect = new Connect();
    OConnect.ConnectDatabase();
    OMainMenu = new MainMenu();
    OMainMenu.InitialSetting();
    Session.setAttribute("OConnect",OConnect);
    Session.setAttribute("OMainMenu",OMainMenu);
    %>

    If Oracle Portal is running on Apache/Jserv, which is the only application server it runs on as far as I know, then that's your problem. JDeveloper uses one of the newer Servlet specificatione, 2.1 or 2.2, where as Jserv is using a very old one. 2.0, which doesn't support the session.setAttribute() method.
    I happen to know a little bit about portal and the JPDK. You do have the option of using the ProviderSession object that is provided by the JPDK PortletRenderRequest.getSession() method. I believe they have a setAttribute() method in there. In fact, if you want this object in the user's session, then you HAVE to use the ProviderSession from the JPDK.
    There are some other configurations you have to set to use this, you must specify to use session in your provider.xml, and you must also set the login frequency on the provider registration page to "Once per user session".
    Check out the discussion boards on http://technet.oracle.com for more info.

  • JSF - spring - hibernate and session

    Hi,
    I'm currently using hibernate spring and JSF
    1/ the first problem
    In the JSF common header page I try to test if a bean is in the session scope in order to show login or logout link, and the test always fails : the logout link is always displayed.
    the JSF page :
    <f:subview id="header" >
        <h:form id="headerForm">
            <table cellspacing="0" width="100%">
        <tr>
            <td align="left" valign="middle">
                  <a href="front.jsf"><img border="0" src="images/logo1.jpg"/></a>
            </td>
        <td align="right" valign="middle"> <br>
       <!--<a href="front.jsf" rendered="#"> Accueil<</a> -->
        <c:choose>
                    <c:when test="${empty sessionScope.accountBean}">
                        <h:commandLink action="Sign on">
                            <h:outputText value="Sign on"/>
                        </h:commandLink>  
                    </c:when>
                    <c:otherwise>
                        <h:commandLink id ="logout" action="#{accountBean.logoutAction}" >
                             <h:outputText value="log out"/>
                        </h:commandLink>
                   </c:otherwise>
                </c:choose>
            </td>
        </tr>
    </table>
    <table cellspacing="0" width="100%">
        <tr>
            <td>
                <hr color="#99ca3c"  size="5" noShade SIZE=1>
            </td>
        </tr>
    </table>
         </h:form>
    </f:subview>The accountBean code :
    public class AccountBean extends BaseBean{
    //private Logger log = Log.getLog(this);
        private String uid;
        private String password;
        private boolean loggedIn;
        private AdminService adminService;
        private Admin admin;
        public AccountBean() {
            this.logger.debug("Authentication");
            this.loggedIn = false;
            uid=null;
            password=null;
           // admin=new Admin();
    public String loginAction() {
              try {
                        this.logger.debug("loginAction");
                         admin = adminService.login(this.uid, this.password);
                                    //this.serviceLocator.getUserService().login(this.username, this.password);
                   if (admin != null) {
                                if("".equals(admin.getUid())|| "".equals(admin.getPassword())){
                                 this.loggedIn=false;
                                    String msg = "Le mot de passe et l'identifiant doivent etre saisis ";
                        addErrorMessage(msg + ", saississez un mot de passe et un identifiant corrects");
                                 return NavigationResults.RETRY;
                                else{
                        this.loggedIn = true;
                                    HttpSession session = SessionUtil.getSession();
                                    session.setAttribute("Admin", this.uid);
                        return NavigationResults.SUCCESS;
                   else {
                        this.loggedIn = false;
                        String msg = "Le mot de passe est incorrect ";
                        addErrorMessage(msg + ", saississez un mot de passe correct");
                        this.logger.debug(msg);
                        return NavigationResults.RETRY;
              catch (UsernameNotExistException ue) {
                   String msg = "L'identifiant (login) est incorrect";
                   this.logger.info(msg);
                   addErrorMessage(msg + ", ressaysissez votre identifiant.");
                   return NavigationResults.RETRY;
              catch (Exception e) {
                   this.logger.error("Could not log in user.", e);
                   addInfoMessage("Could not log in user: Internal Error");
                   return NavigationResults.FAILURE;
          * The backing bean action to logout a user.
          * @return the navigation result
         public String logoutAction() {
              //this.clear();
               FacesContext fc = FacesContext.getCurrentInstance();
               HttpSession session = (HttpSession) fc.getExternalContext().getSession(false);
               session.invalidate();
              this.logger.debug("Logout successfully.");
              return NavigationResults.MAIN;
        public String getPassword() {
            return password;
        public void setPassword(String password) {
            this.password = password;
        public String getUid() {
            return uid;
        public void setUid(String uid) {
            this.uid = uid;
        public Admin getAdmin() {
            return admin;
        public boolean getLoggedIn() {
            return loggedIn;
        public void setLoggedIn(boolean loggedIn) {
            this.loggedIn = loggedIn;
        public void setAdminService(AdminService adminService) {
            this.adminService = adminService;
    }the faces managed bean configuration
    <managed-bean-name>accountBean</managed-bean-name>
        <managed-bean-class>fr.cbmjadmin.views.bean.AccountBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
         <property-name>adminService</property-name>
                <value>#{adminService}</value>
        </managed-property>2/ the second problem :
    my application shows a list of datas.
    I log on the application , i update this list outside the application ( by using sql command) , i try to list my data using the application : the application does not reflect the modifications. I logout using the log out link, then i log on and the application does not reflect the modifications.
    what happens?
    How could I resove these problems.
    How can i logout properly?
    how can i show logout link when the user is logged in? and hide the log out link when the user is logout
    Thanks.

    It depends on how you want to reprecate the session btwn instances or cluters
    there are three kinds File System, Memory to Memory, HA
    You can configure it from this property in the admin console
    Configuration on a cluster -> Availability Service -> Web Container Availability -> Persistence Type:

Maybe you are looking for

  • Purchases with iTunes cards for family sharing.

    I would like to set up family sharing, but was just wondering whether purchases would still be charged to my account even if some members already have iTunes cards loaded on theirs? In my head, it'd make sense for the purchase to be taken from their

  • Airport no longer sharing internet

    I have been using the airport extreme (802.11n) for several years, with few problems. Now it seems that it is only sharing the wireless connection from my modem to one computer at a time, rebooting the modem will allow any OTHER (or the same) compute

  • Another Ipod Problem - Purchased Music wont play

    I just recently recieved my fifth repaired Ipod in a year and a halves time, and now I have another problem. I loaded all of my iTunes songs to my iPod, but all of my purchased music will not play, it just skips over them to the next song. What is go

  • I need sherlock and Front Row 1.3.1 Back!  New Front Row is USELESS!

    I need sherlock back, I used it all the time, now its missing! , also the old Front Row 1.3.1 was AMAZING, the new one looks really bad and the fonts are too small to use from far away (as what it was intended for) I used it before now its just to ha

  • Web service end point question?

    Hello, I m using netbeans6 JCAPS enabled. I have a wsdl that has an endpoint like this; http://abc.com?wsdl We created a web service from this wsdl. We named our service like testwebservice. When our class created we check the endpoint and saw that i