How to Handle user Session in JSP

Help me,
How to handle user session in JSP.......

Prakash_Pune wrote:
tell me some Debugging tech. so i can overcome from my problem.....Do you use an IDE? Any IDE ships with a decent debugger where in you can just execute the code step by step, explore the current variable values and check what exactly is happening. For example Eclipse or IntelliJ. If you don´t use an IDE, then just place some System.out.println() or Logger.debug() statements at strategic locations printing the variables of relevance so that you can track in logs what exactly is happening.
or tell any other way to find is my page is thread safe or not...Just write correct code and narrow the scope of the variables as much as possible. If you for example assigned the user object to a static variable or as a servlet´s instance variable, then exactly the same user object would be used everywhere in the application. That kind of logical things.

Similar Messages

  • Please suggest how to handle User Transactions in JSP using JTA

    we are using Websphere application server with DB2, Can anyone suggest how to maintain the transactions in JSP ?

    What transactions?

  • Problem in implements ADF Faces: Detecting and handling user session expiry

    Hello everybody
    I´m trying to implement a method to handle user session expiry as explained by frank nimphius in his blog.
    http://thepeninsulasedge.com/frank_nimphius/2007/08/22/adf-faces-detecting-and-handling-user-session-expiry/
    I have implemented the class bellow and add the filters in web.xml. However when I add the JavaServer Faces Servlet to sign the filter, my hole application get nuts. I try to publish the applicatoin in the OAS and it seems that it already starts expired.
    Someone konw what I´m doing wrong?
    I use the filter
    <filter>
    <filter-name>ApplicationSessionExpiryFilter</filter-name>
    <filter-class>adf.sample.ApplicationSessionExpiryFilter</filter-class>
    <init-param>
    <param-name>SessionTimeoutRedirect</param-name>
    <param-value>SessionExpired.jspx</param-value>
    </init-param>
    </filter>
    then I add
    XML:
    <filter-mapping>
    <filter-name>ApplicationSessionExpiryFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    package adf.sample;
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    this is the class
    public class ApplicationSessionExpiryFilter implements Filter {
    private FilterConfig _filterConfig = null;
    public void init(FilterConfig filterConfig) throws ServletException {
    _filterConfig = filterConfig;
    public void destroy() {
    _filterConfig = null;
    public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain) throws IOException, ServletException {
    String requestedSession = ((HttpServletRequest)request).getRequestedSessionId();
    String currentWebSession = ((HttpServletRequest)request).getSession().getId();
    boolean sessionOk = currentWebSession.equalsIgnoreCase(requestedSession);
    // if the requested session is null then this is the first application
    // request and "false" is acceptable
    if (!sessionOk && requestedSession != null){
    // the session has expired or renewed. Redirect request
    ((HttpServletResponse) response).sendRedirect(_filterConfig.getInitParameter("SessionTimeoutRedirect"));
    else{
    chain.doFilter(request, response);
    I'm really having trouble controlling user sessions. if someone know where I can get materials to learn how to implements session in Jdev ADF + BC, I´m very grateful.
    Thank you Marnie

    The class works fine.. the issue is when I add the this code into web.xml
    <filter-mapping>
    <filter-name>ApplicationSessionExpiryFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    bellow the web.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <context-param>
    <param-name>CpxFileName</param-name>
    <param-value>userinterface.DataBindings</param-value>
    </context-param>
    <filter>
    <filter-name>ApplicationSessionExpiryFilter</filter-name>
    <filter-class>view.managedBean.ApplicationSessionExpiryFilter</filter-class>
    </filter>
    <filter>
    <filter-name>adfFaces</filter-name>
    <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
    </filter>
    <filter>
    <filter-name>adfBindings</filter-name>
    <filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>ApplicationSessionExpiryFilter</filter-name> ==> the problem occurs when I try to add this code
    <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfFaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jspx</url-pattern>
    </filter-mapping>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>resources</servlet-name>
    <servlet-class>oracle.adf.view.faces.webapp.ResourceServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>1</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/pain</mime-type>
    </mime-mapping>
    </web-app>
    By the way, how can I post code on the forum properly?

  • How to handle  user exits while using BAPI

    HI experts can any one help me on how to handle user exits while using BAPI. Do we need to handle it explicitly or standard  BAPI will take care of it??.
    Regards,
    Hari Krishna

    If you have added some fields using append structures for screen enhancements, then you have to use appropriate user exits to fill these data while calling BAPI.  Some BAPIs have EXTENSION structures to fill the custom data which can be processed using user exists or enhancements.
    Regards
    Vinod

  • Handling user session expiry

    I am trying to implements Frank's way of detecting session expiry.(http://thepeninsulasedge.com/frank_nimphius/2007/08/22/adf-faces-detecting-and-handling-user-session-expiry/)
    It looks so simple and works perfectly well on test application in OC4J servers...
    But it doesnt work on my JBoss.
    Basicaly you take requestSession and currentWebSession in filter and compare them like this:
    String requestedSession = ((HttpServletRequest)request).getRequestedSessionId();
    String currentWebSession = ((HttpServletRequest)request).getSession().getId();
    If session id's are not equal, then it is expired session...But on my JBoss I always get equal session ids and never get requestedSession null (you should get null on initial session)!!! I am realy stuck with this
    I try checking if requested session is valid with isRequestedSessionIdValid() and I always get valid on my JBoss... on OC4J it works properly as well...
    Maybe this has something to do with my secure connection on JBoss?
    Can someone please give me something to hold to!?

    I am trying to implements Frank's way of detecting session expiry.(http://thepeninsulasedge.com/frank_nimphius/2007/08/22/adf-faces-detecting-and-handling-user-session-expiry/)
    It looks so simple and works perfectly well on test application in OC4J servers...
    But it doesnt work on my JBoss.
    Basicaly you take requestSession and currentWebSession in filter and compare them like this:
    String requestedSession = ((HttpServletRequest)request).getRequestedSessionId();
    String currentWebSession = ((HttpServletRequest)request).getSession().getId();
    If session id's are not equal, then it is expired session...But on my JBoss I always get equal session ids and never get requestedSession null (you should get null on initial session)!!! I am realy stuck with this
    I try checking if requested session is valid with isRequestedSessionIdValid() and I always get valid on my JBoss... on OC4J it works properly as well...
    Maybe this has something to do with my secure connection on JBoss?
    Can someone please give me something to hold to!?

  • Detecting and handling user session expiry

    I have implemented Frank's method of detecting expired session (http://thepeninsulasedge.com/frank_nimphius/2007/08/22/adf-faces-detecting-and-handling-user-session-expiry/)-
    basicaly we call session expired when requested session is not equal to current web session. If requested session is null then we say its innitial request.
    But there is situation when this doesn't work properly:
    We are closing our application, but we dont close the browser. Then if we try to open our application again (initial request) our code detects session expiry error, becouse requested session is not null...
    Is there I way to make it work properly?

    I have implemented Frank's method of detecting expired session (http://thepeninsulasedge.com/frank_nimphius/2007/08/22/adf-faces-detecting-and-handling-user-session-expiry/)-
    basicaly we call session expired when requested session is not equal to current web session. If requested session is null then we say its innitial request.
    But there is situation when this doesn't work properly:
    We are closing our application, but we dont close the browser. Then if we try to open our application again (initial request) our code detects session expiry error, becouse requested session is not null...
    Is there I way to make it work properly?

  • How to handle html:multibox in jsp with ADF Data Binding

    Hi,
    I like to use html:multibox feature in my jsp with ADF Data Binding. I am able to retrieve checked values in the DataForwardAction form. However, when the page is refreshed, the checkboxes are not persistent and yet an error showing
    "JBO-25009: unable to create object type ....oracle.jbo.domain.Array" appears.
    Here is my jsp code:
    <c:forEach var="type" items="${bindings.SystemTypeView1.rangeSet}">
    <c:if test="${Row['SystemGroup'] == type['SystemGroup']}">
    <br>
    <html:multibox property="selectedSystemType">
    <c:out value="${type.SystemType}"/>
    </html:multibox>
    <c:out value="${type.TypeDesc}"/>
    </c:if>
    </c:forEach>
    Can anyone tell me how to handle html:multibox with ADF Data Binding and make the checkboxes persistent.

    Generally this can be done.
    I see a problem with your use case, which has nothing to do with jdev or java:
    How do you identify the user when he comes back to finish the form?
    For this you can't use information like session cookie or IP address because they change.
    So you have to save some information about the user which lets you identify him when he comes back. All other requirements can be implemented by ADF.
    Timo

  • How to retrieve User Session in Xcelsius 2008

    Hi
    I am currently building dashboards with some securities on display. The dashboards have to show different views (e.g. Manager view with full access of data and Employee view with partial access of data) for different users, and I expect to get the user information (particularly user name) from the BO user session for making the security decision.
    I can successfully retrieve the user session from Dashboard [url button] to JSP using openDocument (by looking at the cookies), but it seems that I have no way to import the data back to the Dashboard. When I am using Data Manager > XML Data (With XML datasource is a JSP file), it seems the user session cannot be retrieved.
    So, my question is, how to retrieve the user Name in Xcelsius 2008 ?
    Any help is greatly appreciated.

    Hi,
    we did also some research activities about Xcelsius. We are passing the user name to the Xcelsius via Webservice. Based on the portal integration, you do not have to care about the authentication to the Webservice. This does the Enterprise Portal for you. For the integration, we are currently using a BSP solution. In this way, you can get the user name very simple:
    sy-uname
    You can put into the Webservice or provide it as Flash Variable to the Xcelsius in the <OBJECT> tag.
    Take care,
    Thomas

  • How to handle multiple sessions in Script recorder

    Hi,
    I have a requirement to update certain records from a program. For that I have to put a breakpoint the program (which I did manually).
    Now when I use the scripting tool to record the events, only events related to the original session gets recorded. Any events on the newly opened debugger mode is not recorded !
    However, I can record the events in the debugger separately.
    So I have 2 scripts which are session dependent. In Session 1 my program runs and in session 2 (which opens the debugger in runtime) my edits need to be done.
    How to create a VB script which can handle this session issue?
    Went through this blog by Scriptman and since i am new couldnt get it working !!
    Please help me with a framework to handle this issue.
    Activate a session via Gui scripting
    Thanks,
    Jaywant

    Hi Thomas,
    Yes I have to handle both the session simultaneously.  Let me illustrate further.
    I have to update some (10k- 15k) products from a z table in CRM. We have a custom program for this.
    So, i use se38 and insert a breakpoint in the program (to make the updates to a field) and then execute it. Now I start my script recorder. Provide inputs to the program and hit execute.
    At this point my script recorder is running on the se38 window and not on the debugger window !
    I change the values and press F8. These manual updates do not get captured by script recorder.
    But, if I start my recorder once the debugger window was opened already, I can capture all these changes.
    So we have things like this...
    Script1.vbs --> Events captured in se38
    Script2.vbs --> Events captured in the debugger
    If I merge them and run, the recorder is not handling the new debugger session and the execution halts to get the "excel is waiting for another ole action"
    Thanks,
    Jaywant

  • How to handle user exit sequence

    how do handle the userexit sequence i,e in which order the user exits are stored?

    one  and state solution
    go to debugger mode make  breakponint on statement call fm.
    and press f8 continiously and check exit fm one by one.

  • How to check user/session generating a lot of archivelogs?

    Hi,
    On a 10g database, How do i look for the user/session that is generating a lot of archivelogs?
    thanks in advance,

    For currently connected sessions, you could query V$SESSTAT (joining to V$STATNAME). Thus,
    select s.sid, s.value
    from v$sesstat s, v$statname n
    where s.statistic#=n.statistic#
    and n.name = 'redo size'
    order by 2
    /However, there are a few complications :
    1. Persistent Sessions will show up with very high statistics, simply because they haven't disconnected. Many applications maintain Persistent Sessions for either of
    a. Monitoring and Running User Submitted or ScheduleD Jobs (eg in Oracle EBusiness Suite or Peoplesoft)
    b. Connection Pooling
    2. Sessions that have already disconnected will not appear in your report.
    Therefore, you'd have to "sample" sessions frequently and find the incremental redo size. Then, another complication hits you :
    c. Oracle reuses Session IDs. Once a session disconnects, another connecting session may get the same SID. It wouldn't get the same SERIAL# immediately so you might want to use a combination of SID+SERIAL# from V$SESSION as your key (you'd have to add V$SESSION into your monitoring query) Even then, I wouldn't guarantee that the pair wouldn't repeat after some time, particularly with instance restarts.
    You'd be better of using AUDSID from V$SESSION as that value is incremented (and not reused) by session auditing.

  • How to handle user defined exception from C#?

    Hi:
    I have some PL/SQL code that will throw a user defined exception if certain conditions are met. How do I handle user defined exceptions if this procedure/function is being called from C#? C# can handle a normal Oracle SQL error (e.g. ORA-XXXX) because they are defined in the proper class, but how do I get it to know about my user defined exception? Does anyone have any links to examples of doing this?
    Thanks.

    Hi Gaff,
    Is there a particular problem you're having doing this? It works as normal for me...
    Cheers
    Greg
    PLSQL
    =========
    create or replace procedure throwsomething as
    begin
    raise_application_error(-20001,'kaboom');
    end;
    ODP
    =====
        class Program
            static void Main(string[] args)
                using (OracleConnection con = new OracleConnection())
                    con.ConnectionString = "user id=scott;password=tiger;data source=orcl";
                    con.Open();
                    using (OracleCommand cmd = new OracleCommand())
                        cmd.CommandText = "begin throwsomething;end;";
                        cmd.Connection = con;
                        try
                            cmd.ExecuteNonQuery();
                        catch (OracleException oe)
                            Console.WriteLine("caught " + oe.Message);
    OUTPUT
    ========
    caught ORA-20001: kaboom
    ORA-06512: at "SCOTT.THROWSOMETHING", line 3
    ORA-06512: at line 1

  • How to handle user exits in Standalone BIP 10.1.3.4.1

    Hi,
    I tried converting our Oracle 11i (6i reports) report to BI Publisher. Our user exits calls are commented by the BIPBatchConversionUtility.
    Wondering how can we handle user exits part to set the organization id and input the key flexfield information.
    Any help would be greatly appreciated.
    Thanks in advance.
    Thanks & Regards,
    Rama Krishna. P

    Try using BI Publisher beforeReport trigger to set values needed to be set.
    Regards,
    Gareth

  • How to handle user preference which has "_" and " " in the name

    Hi Experts,
    I have a question how to handle value which has like "_" and "space" etc in user preference.
    If setting "a_b-c d", I could not retrieve this because it's escaped in database.
    So this code can't get value even though I can set it.
    Is there any restriction of name? Is there any documentation how to code user prefernece which has non alphabet and number in the name?
    I know it's possible to handle the data like adding escaped data. But I don't think this is the best way to retrieve the data. Because nobody confirm it's not problem in the future.
    Could you tell me the best way to get these user preference?
    Thanks in advance,
    Masaaki Tada
    Here is a sample.
    <%@ page contentType="text/html;charset=Shift_JIS" %><%@ page language="java" import="com.plumtree.remote.portlet.*, com.plumtree.remote.prc.*, java.util.*" %>
    <%
    /** * UserInfo - Simple Page * Display User Information*/
    // VariablesIPortletContext oPortletContext = null;IPortletRequest oPortletRequest = null;IPortletUser oPortletUser = null;IPortletResponse oPortletResponse = null;IRemoteSession s;IUserManager oUser;
    /* Get Portlet Objects */
    try{oPortletContext = PortletContextFactory.createPortletContext(request, response);oPortletRequest = oPortletContext.getRequest();oPortletUser = oPortletContext.getUser();oPortletResponse = oPortletContext.getResponse();} catch (Exception e) {oPortletContext = null;oPortletRequest = null;oPortletUser = null;oPortletResponse = null;}
    String val = oPortletRequest.getSettingValue( SettingType.User, "a_b-c d" );String hoe = oPortletRequest.getSettingValue( SettingType.User, "abcd" );out.println( "a_b-c d: " + val );out.println( "abcd : " + hoe );
    oPortletResponse.setSettingValue( SettingType.User, "a_b-c d", "aiueo" );oPortletResponse.setSettingValue( SettingType.User, "abcd", "bbbb" );%>

    Plumtree recommends that user preference names have only alphanumeric characters in them (a-z, A-Z, 0-9). Any non-alphanumeric characters will be encoded by the EDK.
    I strongly suggest that you change your user pref name to something that's alphanumeric. However, if that is not possible, you can use the following workaround: in the web service editor, enter the encoded name for the user pref. There are several ways to get the encoded name.
    One way is to encode the pref manually, yourself. Plumtree uses the %u encoded format: each non alphanumeric character is converted into %uxxxx, where xxxx is the Unicode representation of the character. For all ASCII characters, just look at the ASCII hex chart. For example, character "-" has a hex value of 2d. So, a preference name "jane_pref" would be encoded to "jane%u002dpref", and you'd enter the latter value on the preferences page in the web service editor.
    The other way to find out the encoded value is to set a preference programmatically and use the HTTP tunnel tool to look at HTTP traffic between the portal server and remote server. The remote server will be sending a HTTP header to the portal server (the header name will probably be CSP-User-Pref) and inside the header you should see the pref name, encoded with %u. Just copy it out of there and into the web service editor.
    Hope this helps,
    Jane

  • CISCO ACS, How to Limit User Session ?

    Hi Guys,
    hope you would help me,
    how to limit the user session in ACS 5.x ?
    i'm aware the menu on
    Access Policies >Max User Session Policy > Max Session Group Settings
    i already set the global value to 1, Max Session for User in Group to 1, and Max Session for Group to 1.
    so it means the user only could open 1 connect at the same time right?
    the problem, it didn't works.
    i had 1 ACS 5.5
    2 CISCO Cisco IOS Software, 3700 Software (C3725-ADVENTERPRISEK9-M), Version 12.4(15)T13, RELEASE SOFTWARE (fc3)
    (let's call it R1 and R2 )
    i'm trying to telnet both of them at the same time, and it works ( it means the session limit didn't works, cmiiw )
    i already include :
    radius-server attribute 44 include-in-access-req
    radius-server host 192.168.217.98 auth-port 1645 acct-port 1646 key somekey
    on the line vty :
     accounting connection acs
     login authentication acs
    am i missing something?
    also, is this feature works on tacacs+ too?
    Thanks,

    Dash,
    You can leverage the group mapping feature where members of a certain AD group are mapped to a local group in ACS with the max sessions defined.
    http://www.cisco.com/c/en/us/td/docs/net_mgmt/cisco_secure_access_control_system/5-3/user/guide/acsuserguide/access_policies.html#pgfId-1162308
    Thanks,
    Tarik Admani

Maybe you are looking for

  • Opening a PDF results in a blank page

    Hello, One of my clients is having problems opening PDF files on his machine.  When he tries to open up a PDF, Internet explorer will open a new blank window.  Refreshing does nothing.  However, sometimes it will open up the actual PDF.  (Maybe 1/10

  • [SOLVED] Reviewing distro's. Request Opinions and experiences

    Good Morning Arch Community, I am asking for usability experiences and opinions on my usages mentioned below. I am now retired due to health issues. I've had a few small strokes. I am/was a C++ developer. Linux Experience: Gentoo Stage #1 installs. W

  • 1Z0-050  Oracle 11g New Features for Administrators

    Which release are the exam 1Z0-050 - Oracle 11g New Features for Administrators, release 1 or release 2? I need to study Oracle University Material Release 1 or Release 2?

  • Android Native Extension cannot find implementation for .so functions

    I can load some .so libraries but can never call any of their functions. All these .so files are known good and work when I publish/install an Android app via eclipse. But any time I try to call functions from an Air native extention I either get "ca

  • ITunes won't let me watch videos.

    I have imported a film, from disk, on to my Mac. It says that it is an MPEG4 and the file extension is .mp4. However, when I try and drag it into iTunes, nothing happens and the videos I already had on there won't play. I recently upgraded to a newer