Session variable and Tracking in Header file

Is there a way for me to keep track of the session and use a variable in my Header to pass around for this?
I have a login.jsp, validate_login.jsp and other jsp's that have the same header file. Instead of me using the same code in all of the jsp's I thought it would be easier to put it in the header Please look at the example code below:
// validate_login.jsp is passed username and password from the login.jsp.
// validate_login then calls the logIn method in my Session class.
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="uom.edu.rd.session.Session"%>
<html>
<head><title>Validate Login</title></head>
<body>
<jsp:include page="header.jsp" />
<%
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    this_session.logIn(username, password);   
    boolean b = this_session.getLoggedIn();
%>
==================================================================
// The logIn method in Session class
public void logIn(String userName, String password) {
         Connection con = null;
         Statement stmt = null;
         ResultSet rs = null;
         try{
            con = db.getConnection();
             stmt = con.createStatement();
             String sql = "SELECT * FROM RD_USER WHERE USER_NAME = '" + userName +"' AND USER_PASSWORD = '" + password + "'";
              rs = stmt.executeQuery(sql);
              if(rs.next()){
                   loggedIn=true;
              }else{
                   loggedIn=false;
         catch(Exception e){
              // If something goes wrong, make sure
              // the user is not logged in.
              loggedIn=false;
          }finally{
              try{
                   rs.close();
                   stmt.close();
                   con.close();
          }catch(Exception e){
     * Log the user out.
    public void logOut() {
         loggedIn = false;
     * Get the login status.
     * @return boolean
    public boolean getLoggedIn() {
         return loggedIn;
==================================================================
// and this is part of my header.jsp
<%@page import="uom.edu.rd.session.Session"%>
<%
  Session this_session = Session.findSession(request);
  if ( this_session==null ) {
      /* Now, instead of redirecting, create a new Session
       * object and initialize it.
      this_session = new Session();
      this_session.makeSession(request);
      this_session.createQueryBuilder(config);     
%>
// This is the part I would like to pass around
<!-- Session logged_in = new Session(); -->
<%   
    boolean loggedIn = this_session.getLoggedIn();    
        if (loggedIn == false)
        { %>
            <A STYLE="color:#FFFFFF;text-decoration:none;" HREF="./login.jsp"><FONT COLOR="#FFFFFF">LOG IN</font></a>  <FONT COLOR="#FFFFFF"></font>
    <%  } else { %>
            <A STYLE="color:#FFFFFF;text-decoration:none;" HREF="./logout.jsp"><FONT COLOR="#FFFFFF">LOG OUT</font></a>  <FONT COLOR="#FFFFFF"></font>
     <% }
%>
// so if you are logged in  then you are able to view certain things on the jsp's if you are not logged in
// then of course you cannot. I want to pass around this loggedIn variable to all the jsp's
// after it checks  loggIn Status for each page I have tried running this but I keep getting an error: cannot resolve symbol this_session

Use <%@ include file="header.jsp" %> instead

Similar Messages

  • Session variable and initialization block issues

    We are using OBIEE 10.1.3.3 and utilizes built in security features. (No LDAP or other single sign on). The user or group names are not stored in any external table. I have a need to supplement Group info of the user to the usage tracking we implemented recently as the NQ_LOGIN_GROUP.RESP column contains username instead of group name. So I created a session variable and associated with a new initialization block and also had a junk default value set to the variable. In the initialization block, I wrote the following query and as a result it inserted correct values into the table when the TEST button was clicked from the initialization block form.
    insert into stra_login_data (username, groupname, login_time) values ('VALUEOF(NQ_SESSION.USER)', 'VALUEOF(NQ_SESSION.GROUP)', SYSDATE)
    My intention is to make this execute whenever any user logs on. The nqserver.log reports the following error and it doesn?t insert values into the table.
    [nQSError: 13011] Query for Initialization Block 'SET_USER_LOGIN_BLOCK' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.USER, has no value definition.
    [nQSError: 13011] Query for Initialization Block 'SET_USER_LOGIN_BLOCK' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.GROUP, has no value definition.
    When I changed the insert statement as below, this does get populated whenever someone logs in. But I need the values of GROUP associated with the user as defined in the repository.
    insert into stra_login_data (username, groupname, login_time) values ('TEST_USER', TEST_GROUP', SYSDATE)
    Could someone help me out! As I mentioned above, I need the GROUP info into the usage tracking. So, if there is another successful approach, could you please share?
    Thank you
    Amin

    Hi Amin,
    See [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3376946&#3376946]. You can't use the GROUP session variable in an Init Block unless it has been seeded from an Init Block first. There isn't an easy solution for what you want, but here are some options:
    1) Create a copy of your User => Groups assignments in your RPD in an table so you can use it in your Usage Tracking Subject Area. But this means you will have to replicate the changes in two places so it's not a good solution.
    2) As the GROUP session variable is populated when you login you could theoretically use it a Dashboard and pass it a parameter to write the value to the database. But as I am not sure how can you make fire only once when the user logins it sounds like a bad idea.
    3) Move your User => Groups assignments from your RPD to a DB table. Use OBIEE Write Back or something like Oracle APEX to maintain them.
    I think 3) is the best solution to be honest.

  • Shared library: function is not found and recognized in header file

    Hello,
    I am trying to use Java methods into LV. I am doing so by creating Java Invocation Interface, usind which I can call Java methods into C++ and then create a shared library that can be called into LV.
    When I am importing my shared library into Labview, I am getting the following error messages:
    The shared library contains 3 function(s). But no function is found and recognized in the header file. The following function(s) cannot be wrapped. If you want to import these functions, please review the warning messages next to the functions below. You will need to fix the problems before you can continue with the wizard.
    jclass invokeJavaClass(JNIEnv* jenv, string className);
    The following symbols are not defined:
    jclass;
    Undefined symbols can prevent the wizard from recognizing functions and parameters. To correct this problem, check the header file to determine if you must add preprocessor definitions. Click the Back button to return to the previous page of the wizard to add a preprocessor definitionsl (for example, "NIAPI_stdcall = __stdcall" or "NIAPIDefined = 1").
    The following header file was not found in the specified header file or one of the referenced header files:
    -  string
    -  iostream
    -  cstring
    -  jni.h
    To fix, click the Back button to go to the previous page and add the header file path to the Include Paths list.
     Please advise.
    Regards,
    H
    Attachments:
    SharedLibError.png ‏51 KB

    Hello Vivek,
    The LabVIEW dll that I am trying to import does not include any third-party device..all my code is fully based on LabVIEW. Maybe this helps you to guess what is happening: once I've parsed the dll' header appears an error
    like this one:
    void
    __cdecl Zdmt(LVBoolean *stop, double P, char channelName[],
        TD1
    *errorIn, TD14 *FFTOptions, TD12 *Calibration, char FileName[],
    int32_t minRecordLength, TD26 *InstrumentHandler, LVRefNum
    sessionRefArray[],
        LVRefNum *queueIN, TD1 *errorOut, LVBoolean
    *averagingDone,
        HWAVES LastRecordFetched, TD24 *Impedance, TD17
    *ColeColeCluster,
        TD18 *FFTcluster, TD5
    *InstrumentHandleOutputCluster, LVRefNum *queueOut,
        int32_t
    *Acquired, TD6 *FreqTimeInfoCluster, double *averagesCompleted,
    int32_t len);
    The following symbols are not defined:
    LVBoolean;
    int32_t; LVRefNum;
    Undefined symbols can prevent the wizard
    from recognizing functions and parameters. To correct this problem,
    check the header file to determine if you must add predefined symbols.
    Click the Back button to return to the previous page of the wizard to
    add a preprocessor definitionsl (for example, "NIAPI_stdcall =
    __stdcall" or "NIAPIDefined = 1").
    The following header file was
    not found in the specified header file or one of the referenced header
    files:
    -  extcode.h
    To fix, click the Back button to go to the
    previous page and add the header file path to the Include Paths list.
    I have replaced the first line #include "extcode.h" of
    the dll header file for #include "C:\Program Files\National
    Instruments\LabVIEW 8.6\cintools\extcode.h" that is the full path where
    the header file is located. However, new libraries seems to be missed:
    -  stdint.h
    -  MacTypes.h
    As far as I know,  Mactypes.h contains basic mac os data types and it doesn't have any relation with stdint.h...
    I have created both of them and stored into the same folder as extcode.h, but then other libraries are missed!!!
    Do you know if it would be possible to create the .dll generating all the header files associated for its data structures???
    And if this is not factible, then what do you suggest me? because I hope to not having to create all the header files until it stops giving me an error!
    thanks for four time,
    ben

  • Missing session variables and multiple CFID/CFTOKEN

    We are using ColdFusion 9.0.1 and have recently started to experience some sporadic behavior in our applications. These applications have worked without error for over 6+ years and have not been modified during this time.
    Over the past couple of weeks, we have been receiving calls in regards to users not being able to login and receiving errors when performing various actions.  We have put troubleshooting measures in place that display values when this occurs.
    We have noticed that when the errors occur, there are multiple CFID/CFTOKEN COOKIE values. Additionally, session variables are being dropped (during simple tasks such as going from one screen to the next).  These errors do not occur for the majority of users and have primarily occurred in Internet Explorer, but we have had some instances in other browsers.  In most instances, if the user switches browsers, the same application works fine for them.
    In one particular case, we have a <cfif> tag in the application.cfm file that checks for “session.user_id”.  If it doesn’t exist, the user is directed to a login page using the <cflocation> tag. When experiencing the problem, users are continuously going back to the login screen because the system is saying that the session variable does not exist.
    When working with one user who was experiencing this problem, we were able to remedy the problem by adding “addtoken=’yes’” to the cflocation tag.  ** We do not prefer to do this for security reasons.
    Rather than go through each application and try to “band-aid” each instance that occurs, can anybody offer some suggestions on why this behavior recently began and how we may be able to globally address it?

    My immediate guess is that there is faulty logic in the code that updates the value of session.user_id. Apparently, one of the following scenarios might be happening.
    Coldfusion creates a session, X, say. Session.user_id is as yet undefined, so ColdFusion cflocates the user to the login page. The user logs in, still within session X. His session.user_id is set.
    Suppose, for whatever reason (and I know of at least two), the session drops. The user's very next request will make ColdFusion to create a new session, Y, say. Under session Y, the variable session.user_id, which corresponded to session X, will no longer exist. So ColdFusion cflocates the user to the login page. This cycle will of course repeat if left uncorrected.
    Another possible scenario is that the variable session.user_id is not set at all, or is set in the context of a new session. I am assuming that the login page is a form. Then login validation occurs at the action page of the form. Presumably the variable session.user_id is set at this action page. If so, then perhaps ColdFusion fails to set this variable, or a new session is created as the request goes from the login-form page to the action page.
    The 2 main reasons why a session drops are 1) it times out, 2) a new request starts a new session. Hence the following suggestions.
    1) Is your sessionTimeout value low, say, just a few minutes? If so, increase it to 20 minutes.
    2) Remember that the default behaviour of ColdFusion is to start a new session at every request. Use cflogin and cfloginuser together with loginStorage="session". Cflogin executes only if there is no logged in user, irrespective of the session. Therefore, getAuthUser() is a better authentication test than session.user_id.
    3) Use Application.cfc in place of Application.cfm. In particular, the CFC offers you more fine-grained control over the beginning and end of sessions.

  • Help building an object, setting it in a session variable and casting

    Hi all,
    I have a problem that I hope you can help me with. The application I am working on has a simple MVC design architecture. The problem occurs when a request is made from the application to the controller servlet. The controller servlet looks at the request type and delegates the processing to the appropriate action and model classes. The model class returns an object of a specific class type that is put into the session variable. This session variable is then cast to the appropriate class type in the jsp that renders that class. The problem is that this particular class type has an array of another class type. The array is filled in the class constructor, but is null when returned to the controller.
    At run time when accessing the array I get a NullPointerException error. I can't seem to figure this one out. Any help is greatly appreciated.
    Here's the code:
    Controller DoPost method. The 'Action' objects are defined and initialized in the init() method.
            public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException{
                    try {
                            HttpSession session = request.getSession();
                            MemberProfileTbl memProf = (MemberProfileTbl)session.getAttribute("Member");
                            RequestDispatcher rd;
                            if (!validateUser(memProf, session)){
                                    session.setAttribute("LoginStatus", "Session Expired");
                                    rd = getServletContext().getRequestDispatcher("/LoginFail.jsp");
                                    rd.forward(request, response);
                                    return;
                            String act = getAction(request);
                            Action action = (Action)actions.get(act);
                            Object result = null;
                            try {
                                    result = action.perform(request, memProf);
                            }catch (NullPointerException npx) {
                                    npx.printStackTrace();
                            session.setAttribute("currObject", result);
                            rd = getServletContext().getRequestDispatcher("/test/MemberConsole.jsp");
                            rd.forward(request, response);
                    catch (Exception ex){
                            ex.printStackTrace();
    Action class:
            package accolo.actions;
            import javax.servlet.http.*;
            import accolo.model .*;
            import accolo.view.*;
            import accolo.db.MemberProfileTbl;
            public class ChangeMainView extends Action {
                    public String getName() {return "changeMainView";}
                    public Object perform(HttpServletRequest request, MemberProfileTbl memProf)
                            throws Exception, ClassNotFoundException, InstantiationException, IllegalAccessException{
                            Object result;
                            HMMainView hmMain = new HMMainView(memProf.email);
                           result = hmMain;
                           return result;
    HMMainView.java class
    public class HMMainView
            private HMMainViewJob[] jobs;
            public String test;
            public HMMainView(String email)
               HMJobsBean hmJobsBean = new HMJobsBean();
               JobTblDao jobTblDao = new JobTblDao();
               test = "test in constructor";
               try{
                 JobTbl[]  hmJobs = jobTblDao.getHMOpenJobs(email);
                 for(int j = 0; j < hmJobs.length; j++){
                            this.jobs[j].jobTitle = hmJobs[j].optionalTitle;
                            this.jobs[j].city = hmJobs[j].city;
                            this.jobs[j].state = hmJobsBean.getState(hmJobs[j].zipCode);
                            Hashtable counts = hmJobsBean.getJSCountsByStatus(hmJobs[j].jobId);
                            this.jobs[j].unranked = (String)counts.get("CANUNRANKED");
                            this.jobs[j].interviews = (String)counts.get("HMRI");
                            this.jobs[j].ranked = (String)counts.get("CANRANKED");
                            long closed = Long.parseLong((String)counts.get("HMRNI"));
                            closed += Long.parseLong((String)counts.get("HMCH"));
                            closed += Long.parseLong((String)counts.get("HMNH"));
                            this.jobs[j].closed = Long.toString(closed);
                }catch(Exception ex){
                    ex.printStackTrace();
            public HMMainViewJob[] getJobs(){ return jobs; }
    HMMainViewJob.java class
    package accolo.model;
    public class HMMainViewJob
            public long jobId;
            public String jobTitle;
            public String status_id;
            public String city;
            public String state;
            public String unranked;
            public String interviews;
            public String ranked;
            public String closed;
            public HMMainViewJob()
    Snippet of JSP that uses the code
      Object result = session.getAttribute("currObject");
      if (result != null){
        String className = result.getClass().getName();
        if (className.equals("accolo.model.HMMainView")){
               header = "HM/HMConsoleHeader.jsp";
               subNav = "HM/HMConsoleSubNav.jsp";
               user = "HM/HMConsoleUser.jsp";
               left = "HM/HMConsoleLeft.jsp";
    //           body = "HM/HMConsoleHome.jsp";
               HMMainView hmMain = (HMMainView) result;
               HMMainViewJob[] jobs = hmMain.getJobs();
              for (int i = 0; i < jobs.length; i++){
    %>
                    Jobs: <%=jobs.jobTitle%>
    <%

    I have not run this through a debugger yet. I don't have immediate access to a debugger to run it through, most of the development is simply done in vi. I was hoping any problem in the code would jump out at someone. I've been staring at it too long.
    I'll try to get a debugger set up.
    Thanks

  • RH10 variable and build tag source file names

    I'm using RH10 and outputting to WebHelp. My company requires that I archive project source files to our CVS via Eclipse. I am not using RoboSource_Control and must use the company's development resources for archiving.
    Since archiving the initial project, I have been uploading only source files with modified dates.
    However, I have discovered that the files I thought were storing user variables and build tags are not the correct files to archive. Since I am uploading all files with a newer date and that's not working, I need to know the user variable source file name and the build tag source file name that stores the currently defined variables and build tags.
    I have already tried the WebHelp forum and was directed to this forum to pose the question because I'm looking for source file information instead of output file information.
    Thanks for your help!
    karen

    Yes, Eclipse does work that way. However, we do not use our development directory as the local Eclipse repository. I need to move changed files to the local repository (stores all source files in the project) so that Eclipse can upload changes to the server. Yes, this is planned redundancy.
    That said, it is not acceptable to spend the time copying all files in the large projects from the work folder to the local repository. I simply need to know which individual files to copy that include the currently defined variables and build tags. Note, we do not copy the SSL folder output files to our local source file repository, or other associated reference files that are not actually project source files.
    Can you find someone who knows which files I need?
    Thanks,
    karen

  • Session variable and script error

    Hello;
    I am still writting this script that turns a bg sound on and
    aff for the whole site to remember. I have a good start on this
    code, but I am running into issues.
    1. I am trying to use a checkbox to make the selection, and
    when it is clicked, it will function without using a submit button,
    the java script I am using isn't doing the job allowing the
    checkbox to act as a link so to speak.
    2. I need to make this script into a session variable. So
    that when the decision is made, the site will remember it.
    3. there might be a problem in my IF statement.
    Can someone please help me out? I am attaching the code. It
    is using a DB that has a yes/no box in the table this sound code is
    accessing.
    Thank you.
    Phoenix

    A Quess...
    Remove the OnClick in the form
    <form onClick="category.submit();">
    Place it in the input type?
    <input type="checkbox"
    onClick="category.submit();">

  • Question about session variables and binding

    Hi All,
    I'm a newbie with Application Express. I've gone through several tutorials and a book, and now I'm actually getting started with apex. My first adventure is a tiny little form, where all you do is fill it out and it sends an email. Pretty simple.
    And, i have it working just fine - but I have a question about something I don't quite understand. Basically, I am generating the email text in a page process. And some of the form fields work fine if i reference them as *:ACCT_NAME*, but some give me the dreaded "not all variables bound" error. For the ones that give me the error, I can reference them like V('ACCT_NAME').
    So, as a newbie, I'm a little confused. When is it appropriate to use the V function, and when it is appropriate to use binding? Why would one of the fields work with binding but not another from the same form?
    Thanks for any clarification you can offer,
    Lisa

    Lisa,
    A bind variable is a place holder variable available in an environment.It is used quite frequently(outside Apex Context) in SQL and PLSQL scripts and especially in Dynamic SQL statements.Many times using a bind variable gives better performance. In the Apex environment,page items and many other variables related to the session are available as bind variables and hence their value can be referred in SQL,PLSQL contexts as :VARIABLE_NAME.
    Now V() function is an apex specific function which returns the value of an apex session variable outside the apex environment. So as Machaan pointed out, it is used in
    procedures and triggers that gets called from within an apex session. This is required since the bind variables themselves are not directly available in the SQL environment but their values from the corresponding session can be accessed by this apex built-in function.
    The length of any Bind variable name is limited to 30 characters, this is a limitation inherited from Oracle SQL itself and hence session variables(page or application items) whose name has a length which exceeds 30 characters cannot be used as the :ITEM_NAME format. In such cases you would have to use the v() method again. This might be happening in your case.

  • Javacard and session variables

    Hello,
    I'm trying to find a reasonable Javacard technique to handle "session variables" that must be kept between successive APDUs, but must be re-initialized on each card reset (and/or each time the application is selected); e.g. currently selected file, currently selected record, current session key, has the user PIN been verified...
    Such variables are best held in RAM, since changing permanent (EEPROM or Flash) variables is so slow (and in the long run limiting the operational life of the card).
    Examples in the Java Card Kit 2.2.2 (e.g. JavaPurseCrypto.java) manipulate session variables in the following way:
    1) The programmers group session variables of basic type (Short, Byte, Boolean) according to type, and map each such variable at an explicit index of a vector (one per basic type used as session variable).
    2) At install() time, each such vector, and each vector session variable, is explicitly allocated as a transient object, and this object is stored in a field of the application (in permanent memory), where it remains across resets.
    3) Each use of a session variable of basic type is explicitly translated by the programmer into using the appropriately numbered element of the appropriate vector.
    4) Vector session variables require no further syntactic juggling, but eat up an object descriptor worth of permanent data memory (EEPROM or Flash), and a function call + object affectation worth of applet-storage memory (EEPROM, Flash or ROM).
    The preparatory phase goes:
    public class MyApp extends Applet  {
    // transientShorts array indices
        final static byte       TN_IX = 0;
        final static byte       NEW_BALANCE_IX=(byte)TN_IX+1;
        final static byte      CURRENT_BALANCE_IX=(byte)NEW_BALANCE_IX+1;
        final static byte      AMOUNT_IX=(byte)CURRENT_BALANCE_IX+1;
        final static byte   TRANSACTION_TYPE_IX=(byte)AMOUNT_IX+1;
        final static byte     SELECTED_FILE_IX=(byte)TRANSACTION_TYPE_IX+1;
        final static byte   NUM_TRANSIENT_SHORTS=(byte)SELECTED_FILE_IX+1;
    // transientBools array indices
        final static byte       TRANSACTION_INITIALIZED=0;
        final static byte       UPDATE_INITIALIZED=(byte)TRANSACTION_INITIALIZED+1;
        final static byte   NUM_TRANSIENT_BOOLS=(byte)UPDATE_INITIALIZED+1;
    // remanent variables holding reference for transient variables
        private short[]     transientShorts;
        private boolean[]   transientBools;
        private byte[]      CAD_ID_array;
        private byte[]      byteArray8;  // Signature work array
    // install method
        public static void install( byte[] bArray, short bOffset, byte bLength ) {
             //Create transient objects.
            transientShorts = JCSystem.makeTransientShortArray( NUM_TRANSIENT_SHORTS,
                JCSystem.CLEAR_ON_DESELECT);
            transientBools = JCSystem.makeTransientBooleanArray( NUM_TRANSIENT_BOOLS,
                JCSystem.CLEAR_ON_DESELECT);
            CAD_ID_array = JCSystem.makeTransientByteArray( (short)4,
                JCSystem.CLEAR_ON_DESELECT);
            byteArray8 = JCSystem.makeTransientByteArray( (short)8,
                JCSystem.CLEAR_ON_DESELECT);
    (..)and when it's time for usage, things go:
        if (transientShorts[SELECTED_FILE_IX] == (short)0)
            transientShorts[SELECTED_FILE_IX] == fid;
        transientBools[UPDATE_INITIALIZED] =
            sig.verify(MAC_buffer, (short)0, (short)10,
                byteArray8, START, SIGNATURE_LENGTH);I find this
    a) Verbose and complex.
    b) Error-prone: there is nothing to prevent the accidental use of transientShorts[UPDATE_INITIALIZED].
    c) Wastefull of memory: each use of a basic-type state variable wastes some code; each vector state variable wastes an object-descriptor worth of permanent data memory, and code for its allocation.
    d) Slow at runtime: each use of a "session variable", especially of a basic type, goes thru method invocation(s) which end up painfully slow (at least on some cards), to the point that for repeated uses, one often attain a nice speedup by caching a session variable, and/or transientShorts and the like, into local variables.
    As an aside, I don't get if the true allocation of RAM occurs at install time (implying non-selected applications eat up RAM), or at application selection (implying hidden extra overhead).
    I dream of an equivalent for the C idiom "struct of state variables". Are these issues discussed, in a Sun manual, or elsewhere? Is there a better way?
    Other desperate questions: does a C compiler that output Javacard bytecode make sense/exists? Or a usable Javacard bytecode assembler?
    Francois Grieu

    Interesting post.
    I don't have a solution to your problem, but caching the session variables arrays in local variable arrays is a good start. This should be only done when the applet is in context, e.g. selected or accessed through the shareable interface. This values should be written back to EEPROM at e.g. deselect or some other important point of time. Do you run into problems if a tear happens? I don't think so since the session variables should be transactional, and a defined point will commit a transaction.
    Analyzing the bytecode is a good idea. I know of a view in JCOP Tools (Eclipse plugin) where you can analyze the bytecode and optimize it to your needs.

  • 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.

  • Help with session variable please - CS5.5 PHP

    Hi all,
    I am needing a little assistance with using a session variable and hope that someone may point me in the right direction.
    I have created a PHP page that uses the Dreamweaver 'User Authentication' feature, and the basics of this works fine, directing a user to the correct pages depending on whether they are or are not a valid user. I would like however to personalise the 'valid user' page with the persons Username as entered in the User Authentication table....a seemingly simple task using a session variable, but one that I just don't seem to be able to get working!
    The code generated for the UA on page 1 is as follows:
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
      session_start();
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
      $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    if (isset($_POST['txtfirst_name'])) {
      $loginUsername=$_POST['txtfirst_name'];
      $password=$_POST['txtsurname'];
      $MM_fldUserAuthorization = "";
      $MM_redirectLoginSuccess = "member_update.php";
      $MM_redirectLoginFailed = "login.php";
      $MM_redirecttoReferrer = false;
      mysql_select_db($database_panto, $panto);
      $LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND surname=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $panto) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
        if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
        //declare two session variables and assign them
       $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;         
        if (isset($_SESSION['PrevUrl']) && false) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];   
        header("Location: " . $MM_redirectLoginSuccess );
      else {
        header("Location: ". $MM_redirectLoginFailed );
    ?>
    Firstly, the text highlighted in red above appears to be setting the session variable that I require. Is This correct?
    If so, what is the code that I need to place in page 2 to use that session variable? or
    Do I need to do something else on page 1 to properly assign the session variable?
    Would really appreciate your expertise
    Mark

    It looks as though you've set the columns incorrectly in the User Authentication server behavior. This is the SQL query that checks the user's credentials:
      $LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND surname=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
    You're looking for firstname and surname, whereas you should be looking for the user's login name and password.
    $_SESSION['MM_Username'] is a session variable that stores the user's login name. To use it in a subsequent page, all that's needed is for the page to begin with session_start(). You can then echo the value to display it.
    If you want to display the person's real name, you need to create a recordset in the second page using $_SESSION['MM_Username'] to find the firstname and surname. Alternatively, you can edit the existing code like this (I've copied only part of it):
      $LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND password=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $panto) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
        $row = mysql_fetch_assoc($LoginRS);
         $_SESSION['full_name'] = $row['firstname'] . ' ' . $row['surname'];
        if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
        //declare two session variables and assign them
       $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;
    You can then use $_SESSION['full_name'] in a subsequent page that begins with session_start().

  • CFLOGIN not maintaining cfauthrization session variable

    I have a simple CF web site where all of the .cfm is in the
    same directory. I can not use client cookies as the people I am
    writing this for have cookies turned off in IE, therefore I am
    using J2EE session variables and CFLOGIN in an application.cfm file
    (code attached) for authentication. Everything works correctly
    during login and I can see the encrypted username/password as the
    cfauthorization session variable....
    Session Variables:
    cfauthorization=Y3BkYWRtaW46cmVwb3J0ODQzOmNwZA==
    sessionid=c23059df643c42544069
    urltoken=CFID=783&CFTOKEN=91556252&jsessionid=c23059df643c42544069
    Once I try to browse to another cfm page on the site, I get
    booted back to the index.cfm login page. After some digging I
    figure out that the cfauthorization variable was blank after I
    click on the link, which as I understand it indicates that I am not
    logged in and the
    <cfif not IsDefined("cflogin")>
    <cfinclude template="index.cfm">
    <cfabort>
    code in the application.cfm sends me back to the login page.
    I have confirmed that using valid credentials causes <cfif
    cpdauth.recordcount GT "0"> to return true.
    Any idea as to why my session authorization is not being
    maintained between pages? Or if I am completely off base as to the
    reason this is happening.....and if so, what am I doing wrong.
    Thanks
    Greg

    Your login code seems to be fine. You yourself are already
    aware that you have to have a way to pass-the-baton between
    requests, to maintain a session.
    The usual way Coldfusion maintains sessions is to send CFID
    and CFTOKEN cookies to the client browser. That happens
    automatically under the hood, assuming you haven't switched
    setClientCookies off.
    For session management by means of cookies, I would use a
    cfapplication tag like
    <cfapplication name = "cpd"
    applicationTimeout = "#createTimespan(1,0,0,0)#"
    sessionManagement = "yes"
    clientManagement = "yes"
    sessionTimeout = "#createTimeSpan(0,0,20,0)#"
    setClientCookies = "true"
    scriptprotect="all"
    loginstorage="Session">
    However, all of that assumes that the client browser accepts
    cookies. Where it doesn't, the usual way to maintain sessions is to
    pass CFID and CFTOKEN values in the URL of every request. In fact,
    the function that Bluetone suggests,
    URLSessionFormat,
    makes the process efficient. It instructs Coldfusion to append CFID
    and CFTOKEN to the URL only when the client doesn't accept cookies.
    Which means Coldfusion would still be using cookies wherever
    possible. Some examples
    <a href="#URLSessionFormat('orders.cfm')#">My
    orders</a>
    <cfform method="Post"
    action="#URLSessionFormat("MyActionPage.cfm")#">
    </cfform>
    <cflocation url = "products.cfm" addToken = "yes">

  • Login session variable - pls help before i slot myself

    im brand new to this guys and really struggling with logging
    in a member to their particular account as opposed to a general
    members section using dreamweavers login application and some basic
    php coding.
    i just cant seem to figure it out it (im stuck on the session
    variables i think..) and unfortunately my php is very poor at them
    moment!
    pls HELP!!
    below is the dreamweaver generated code from its basic login
    application.
    im using it in a dreamweaver template so im not sure if thats
    the issue but bascially im using 2 SQL tables i constructed to
    achieve this-
    1.) tblaccesslevel
    intLevelID (unsigned + auto increment + primary key)
    txtAccess
    (ive allocated various numerical access levels into
    txtAccess. ie. 1-7
    and
    2.) tblplayeraccount
    intUserID (unsigned + auto increment + primary key)
    txtFirstName
    txtLastName
    txtEmailAddress
    txtPassword
    intAccessLevel
    (ive generated 2 users in the above table tp test)
    in dreameavers server behaviors the recordset generated by
    the login server behavior simply says Log In User
    obviously i need a session variable somewhere to get the
    intUserId....
    also a relationship needs to be generated in the sql
    statement to connect the intAccessLevel but i think i can manage
    that (i think..)
    below is the code this application generated -
    if someone can give me some hints or if they've done
    something similiar pls provide the required code ...it would be a
    huge help!! i dont know what im doing wrong!!!
    <?php require_once('../Connections/Rugby.php'); ?>
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
    session_start();
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
    $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    if (isset($_POST['emailaddress'])) {
    $loginUsername=$_POST['emailaddress'];
    $password=$_POST['password'];
    $MM_fldUserAuthorization = "intAccessLevel";
    $MM_redirectLoginSuccess = "../player_home.php";
    $MM_redirectLoginFailed = "../failed.php";
    $MM_redirecttoReferrer = false;
    mysql_select_db($database_Rugby, $Rugby);
    $LoginRS__query=sprintf("SELECT txtEmailAddress, txtPassword,
    intAccessLevel FROM tblplayeraccount WHERE txtEmailAddress='%s' AND
    txtPassword='%s'",
    get_magic_quotes_gpc() ? $loginUsername :
    addslashes($loginUsername), get_magic_quotes_gpc() ? $password :
    addslashes($password));
    $LoginRS = mysql_query($LoginRS__query, $Rugby) or
    die(mysql_error());
    $loginFoundUser = mysql_num_rows($LoginRS);
    if ($loginFoundUser) {
    $loginStrGroup = mysql_result($LoginRS,0,'intAccessLevel');
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;
    if (isset($_SESSION['PrevUrl']) && false) {
    $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
    header("Location: " . $MM_redirectLoginSuccess );
    else {
    header("Location: ". $MM_redirectLoginFailed );
    ?>

    Are you wanting to redirect them to a specific page based on
    their username or to the same page with dynamic content based on
    their username?

  • Login Session Variable Problem

    I've created a simple login using the inbuilt DW suite, but I don't seem to be able to display the session variable after they login.
    On the success page it should filter the RS based on the Username and also display the Username etc on the page but nothing is shown. I tested the success page in DW and entered a value for the session var and it works fine, all I can think of is that the session is empty, not coming through, but I'm clueless.
    Any ideas?
    <<<<<LOGIN PAGE>>>>>
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
      session_start();
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
      $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    if (isset($_POST['UserName'])) {
      $loginUsername=$_POST['UserName'];
      $password=$_POST['Password'];
      $MM_fldUserAuthorization = "";
      $MM_redirectLoginSuccess = "login_successful.php";
      $MM_redirectLoginFailed = "login.php";
      $MM_redirecttoReferrer = true;
      mysql_select_db($database_connpbxlogin, $connpbxlogin);
      $LoginRS__query=sprintf("SELECT UserName, UserPassword FROM Users WHERE UserName=%s AND UserPassword=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $connpbxlogin) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
        //declare two session variables and assign them
        $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;     
        if (isset($_SESSION['PrevUrl']) && true) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
        header("Location: " . $MM_redirectLoginSuccess );
      else {
        header("Location: ". $MM_redirectLoginFailed );
    ?>
    <<<<<SUCCESS PAGE>>>>>
    $colname_LoggedRS = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_LoggedRS = $_SESSION['MM_Username'];
    mysql_select_db($database_connpbxlogin, $connpbxlogin);
    $query_LoggedRS = sprintf("SELECT * FROM Users WHERE UserName = %s", GetSQLValueString($colname_LoggedRS, "text"));
    $LoggedRS = mysql_query($query_LoggedRS, $connpbxlogin) or die(mysql_error());
    $row_LoggedRS = mysql_fetch_assoc($LoggedRS);
    $totalRows_LoggedRS = mysql_num_rows($LoggedRS);
    ?>
    <!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" />
    <title>Untitled Document</title>
    </head>
    <body>
    </p>
    <p>username: <?php echo $row_LoggedRS['UserFirstName']; ?></p>
    <p>email: <?php echo $row_LoggedRS['UserEmail']; ?></p>
    <p>Session Data:
      <?php echo $_SESSION['MM_Username']; ?></p>
    </body>
    </html>
    <?php
    mysql_free_result($LoggedRS);
    ?>

    Does your success page begin with session_start()?

  • Accessing session variables PHP

    I am trying to access a session variable from a log in form (using the Log In User Server Behavior) and am lost. I simply want to display the users information in the target page. I read in another discussion that I had to bind the variable to the target page, which I did, but that didn't fix it.
    Please help.
    Here is my loginFormAction code:
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
      session_start();
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
      $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    if (isset($_POST['email'])) {
      $loginUsername=$_POST['email'];
      $password=$_POST['password'];
      $MM_fldUserAuthorization = "";
      $MM_redirectLoginSuccess = "owner.php";
      $MM_redirectLoginFailed = "register.php";
      $MM_redirecttoReferrer = false;
      mysql_select_db($database_petriever, $petriever);
      $LoginRS__query=sprintf("SELECT email, password FROM owners WHERE email=%s AND password=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $petriever) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
        //declare two session variables and assign them
        $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;      
        if (isset($_SESSION['PrevUrl']) && false) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
        header("Location: " . $MM_redirectLoginSuccess );
      else {
        header("Location: ". $MM_redirectLoginFailed );
    ?>

    Wherever you want to display the logged-in username simply place this on the first line of a .php page to start the session:
    <?php session_start(); ?>
    Then place this code wherever you want to display the username:
    <?php echo $_SESSION['MM_Username']; ?>

Maybe you are looking for

  • Cover Flow preview in Finder fails to work

    Hello, I updated recently to  OS X Mavericks, and since i updated there have been problems in the Preview (Cover Flow preview in Finder. When i open a folder and scroll down items, sometime there are 10 images and in cover flow shows only half and th

  • How to extract UDA contents

    I want toget a text file listing the manders in a dimension and the UDAs associated with them. How can I do this? I am runingEssbase 5 on this cube.I have had no luck with the OLAP Underground Outline Extractor, which crashes whenever I use it.

  • Transfering documents from 1 app to another

    Hi, I just bought following apps which are working fine. 1: SignMyPad 2: Quickoffice I am creating files in Quickoffice and converting them into PDF. I want to sign the document from SignMyPad which i created in Quickoffice. But can't find open in op

  • New printing problem with InDesign CS4

    After having great success with Aisolve's earlier fix on printing from InDesign CS4 after upgrading to Lion, I'm having a new problems after installing the OS X 10.7.2 upgrade last week. When I try to print from  InDesign CS4 and Illustrator CS4 to m

  • Different number of data records in source system and BI system

    Hi all, I have been using datasources 0HR_PA_0 and 0HR_PA_1. When I run and check the records in source system via RSA3 there are 4893 and 360 records respectively. When I extract the records into my 0PA_C01 cube, however, 3058 and 249 records are co