Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to check if a session object exists (or is not null)?

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to check if a session object exists (or is not null)?

    I want to auto-populate fields on a form based on whether or not a session object is populated. How do I verify whether this object is populated using java?

    	RequestObj requestObj = new RequestObj();
    	requestObj = (RequestObj) sessionMap.get("RequestObj");
     
    // If Session object (requestObj) is not null then:
    	this.setOfficeLocation(requestObj.getOfficeLocation());
    // End if.

    Thanks!


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    563
    My Mood
    Sleepy
    Thanks
    9
    Thanked 82 Times in 76 Posts

    Default Re: How to check if a session object exists (or is not null)?

    Huh?!
    if(requestObj != null){
        this.setOfficeLocation(requestObj.getOfficeLocation());
    }

Similar Threads

  1. [SOLVED] Check if system tray already exists
    By keepStriving in forum Java Theory & Questions
    Replies: 25
    Last Post: December 17th, 2013, 05:37 PM
  2. How do you check to see if a RandomAccessFile already exists?
    By ineedahero in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 2nd, 2013, 09:12 AM
  3. How to retrieve an object from a session attribute
    By jaltaie in forum JavaServer Pages: JSP & JSTL
    Replies: 7
    Last Post: September 3rd, 2013, 07:08 AM
  4. check if table exists from a list of files in a directory
    By efoikonom in forum JDBC & Databases
    Replies: 1
    Last Post: June 10th, 2013, 08:42 AM
  5. how to check null
    By veens in forum JDBC & Databases
    Replies: 7
    Last Post: November 16th, 2011, 05:54 PM