Is session on a jsp different then a HttpSession ?

It kind of seems like a silly question to ask. I thought they were the same thing. basically i'm moving some java code thats on a jsp to a bean where it belongs (stupid people before me)
one function i need some data from the session. So i passed the request to the bean and then got the session out of the request.
on jsp:
helperbean.doStuff(request);
on helperbean
doStuff(HttpServletRequest request);
HttpSession session = request.getSession(false) //dont' create a new session
so thats how its working. basically
i'm moving some code dealing with xml parsing that my company wrote off the jsp as mentioned
so the code is
XMLParser test = new XMLParser
test = (XMLParser)session.getAttribute("Blah");
and then goes on. Everything works fine and dandy..
now in the helpbearn when i do the same thing. My try loop catches a ClassCastException (suprise suprise) its really frustrating me.
I don't understand why it would work on the jsp and not in the helperbean?
I thought that maybe session is considered something different on a helperbean compared to a jsp. I know its the same thing, but maybe its declared differently?
any ideas on that one? I know i just rambled for about 5 minutes. I'm pretty sure i didn't mistype code so i'm search other avenues.
Thanks

Thanks for the help. I stepped out and and made some changes and you guys beat me to the board before i could comment how dumb my question was ;)
I've been using debuggin statements so i've got it pretty much narrowed down to where it throws the exception and i'm printing the stack
i'm pretty sure session.getAttribute("blah"); is returning a string right now. which would toss the exception. I looked further up on the page it works and saw that someone was resetting the session variable blah to an XMLParser object. So thats probably where i went astray.
Thanks again

Similar Messages

  • How to use session object in jsp

    hi all
    marry christmas
    can anyone plz tell me how to use session obect in jsp
    rachna
    Message was edited by:
    rachna_arora82

    hi rachna,
    JSP has a default(implicit) session object...... use the getSession(true) method on the session object and then going u can either get or set attributes depending on the requirement
    That was in general and now with the issue u have got..... what u can do is that the u can create session for every user who logs in and when he/she tries to login again then u can probably check for the existing session object in the JSP and perform the logic as required..... any clarifications plzzzzzzz let me know
    Thanks n Regards
    Naveen M
    Message was edited by:
    Novice_inJAVA
    Message was edited by:
    Novice_inJAVA

  • Calling Session Beans in JSP ?

    Hi Folks,
    I am new to EJB3, I am doing simple applicatuions.
    Can any one please tell me how to call session beans in jsp page.
    for example my case is.. iam entering two diffrent data, lets say user name and password in jsp page and this should go in data base thru JPA (entity beans)
    Iam able to enter data from JPA in data base but if the same i have to fetch from JSP page.. iam not getting..!
    I would really appretiate for your help i need it urgent...!
    thanks in advance.

    abishek1983 wrote:
    Hi Folks,
    I am new to EJB3, I am doing simple applicatuions.
    Can any one please tell me how to call session beans in jsp page.
    Not. You can, technically, but you shouldn't. JSP should be for display purposes only, containing no Java code whatsoever.
    for example my case is.. iam entering two diffrent data,Wrong. You cannot possibly have "2 data", the very concept is impossible.
    You can have "2 data items" which is probably what you intended to say?
    lets say user name and password in jsp page and this should go in data base thru JPA (entity beans)
    Iam able to enter data from JPA in data base but if the same i have to fetch from JSP page.. iam not getting..!
    Same way you insert them. Of course JPA entities are distinctly different from entity beans. The very concept of entity beans no longer exists in the context of JPA, it's solely used to mean EJB 2.1 or earlier entity beans.
    I would really appretiate for your help i need it urgent...!
    It's not urgent.

  • Session tracking in JSP pages

    I've two pages in my web application which need regular refresh after a particular interval.I'm using
    (session.setMaxInactiveTime) to check the session validation.& HTML's <META> tag to regularly refresh the page after particular interval.
    On these two pages there are links to the different pages for which i'm opening a new window.
    But i'm losing the session after some time & i'm not able to catch the source from where the session is getting invalidated.even when i'm using meta tag of html to refresh the page.
    I'm also using HttpSessionEventListener Interface to know when the session.putValue & session.removeValue
    functions are used.
    I hope the problem is clear to you people.
    an urgent help/suggestion will be appreciated.
    thanks in advance

    Hi,
    it isn't easy see your problem. When you losing your session? When you hava open a link from your page i a new browser window (instance) and return?
    Also check follow: when no validate session exist, a jsp open a new session, else you use <%@ page session="false" %>
    Roland

  • Session Maintenance in JSp-- Servlet-- JSP

    Iam making a browser based Financial Aplication so I want to introduce sessions into it.
    My First page is a JSP which takes username and Password. Then it calls a servlet.
    So my Problems are-
    1. Iam able to start session from servlet (which validates username and password) but after that in the apllication some JSp's are there like for search options so how to maintain sessions in JSP's ?
    2. When user quits browser and then opening a browser and directly types a JSP page which is in-between the flow this JSP opens up whereas i want the user to go from starting as its a security loop hole.
    So how to maintain a session in a JSP (ie when control passes from Servlet to JSP at that time)?
    Plz Help me
    Thanks in advance

    Hi Innova,
    There is a solution .I think while validating the login page entries u should maintain a session variable and give it some constant value if the entered values are valid.And now u should always check this sesson variable for that constant value [ if(session.getParameter("s")==constvalue) ] only then u proceed further else diaplay an error message or link prompting to login
    I hope it will work fine check it out.
    GoodLuck.
    Bye......

  • How to retrieve sessions variables in JSP

    hi,
    I am trying to retrieve session variable from servlet to JSP.
    In the servlet i am retrieving employeenames from database and storing them in a ArrayList variable then i am setting this variable into the session.
    When retrieving the session in the jsp it displays as [empname1, empname2].
    Please help how to retrieve them
    Thanks in Advance,
    sha

    At the servlet:
    ArrayList<String> employeeNames = new ArrayList<String>();
    employeenames.add(blahBlahblah);
    session.setAttribute("eNames", employeeNames);
    At the JSP:
    ArrayList<String> names = (ArrayList<String>) session.getAttribute("eNames");
    for (String nom : names) {
    do something with the name stored in String variable nom...
    }

  • What role can ejb Session Beans  play  jsp session tracking

     

              I am also looking for a way to use JSP as ejb client with WLS5.1. i would appreciate any help.
              -Girish
              Prasad Peddada <[email protected]> wrote:
              >David,
              >     The beans which are refered in jsp specs are java beans and not EJB.
              >
              >Prasad
              >
              >David Levy wrote:
              >>
              >> Hello,
              >>
              >> We are using Jsp/Servlets which will hold session state and subsequently
              >> call ejb Session Beans for transaction/persistence coordination . We are
              >> not sure if we are using the correct techniques to control object memory.
              >>
              >> Summary of what we have:
              >>
              >> A jsp with the "useBean" directive:
              >> <jsp:useBean id="MySession" class="com....MySession"
              >> scope="session"></jsp:useBean>
              >>
              >> The class MySession holds other classes ( all serializable).
              >> The class MySession is NOT an ejb Session Bean
              >>
              >> Questions:
              >> We are considering making class MySession an ejb Session Bean so (via it's
              >> passivate/activate feature) we can control instances in memory as more web
              >> clients start the session from the jsp page. I.E. all web clients will have
              >> their own HttpSession instance which holds on to an ejb Session Bean object
              >> "MySession"( or a passivated representation of it)
              >>
              >> 1) Is this a sufficient approach or will there be other memory concerns?
              >> I.E. What about all the HttpSession objects out there? Do they need to be
              >> passivated as well?
              >>
              >> 2) If its a good idea to passivate the HttpSessions as well, then what
              >> mechanism should be used ( servlet session persistence)? Also, if we are
              >> passivating the HttpSession (which holds on to the MySession object graph)
              >> , then why bother with the SessionBean for passivation
              >>
              >> 3) Currently, we only have a single instance of a servlet handling all
              >> requests. Will multiple instances buy us anything?
              >>
              >> 4) How does clustering relate to this topic?
              >>
              >> 5) Can we change the "jsp:useBean" directive so MySession is an ejb Session
              >> Bean or do we have to do the "home.create()" within a jsp script?
              >>
              >> thanks,
              >> dave
              

  • How to use session variable in JSP function  & How to use both JSP  Servlet

    Hi,
    I am new to JSP and servlets
    Still I am devloping a website in JSP. I am not mixing JSP with servlets, but I do create Java files for bean, logic and database works.
    I try to keep the hard coding part out of JSP.
    I dont how to use both JSP and Servlets in combination.
    Hence If needed I write some functions in JSP.
    but it gives me error
    +<%! public void abc()+
    +{+
    int intUserId = Integer.valueOf((Integer) session.getAttribute("MySession_UserID"));
    +}+
    +%>+
    Saying cannot find symbol session
    1) So can u please tell how can I access session variables within JSP function
    2) And also give me some links/tutorials about useing both JSP and Servlets in combination.
    Thanks
    Venkat

    The application architecture when you use Servlets and JSP in a standard MVC pattern is explained here (under the heading "Integrating Servlets and JSP Pages") and here ...

  • How to know if a session finished in jsp

    Hello,
    How to know if a session finished in jsp?
    Help me please.
    Best Regards.
    Joseph

    Depends. You can create a javax.servlet.http.HttpSessionListener implementation and register it in the web.xml file (I forget the syntax, though), which can notify you of sessions being created and destroyed.
    Or you can create a javax.servlet.http.HttpSessionBindingListener implementation and add it to the session (setAttribute()) and it'll have it's valueUnbound method called when the session expires (or the attribute is removed, but if you don't remove it, the session invalidating will). That's a good place for session-specific clean-up.

  • Why is the view of the clip different then the view of the project?

    why is the view of the clip different then the view of the project?

    Yes you are correct, it is with the setting of the properties.
    Where do i report this then if it is not with the SDK but the manual setting of properties.
    Also, how do i alter this ussue with the SDK, what are the commands, does it have to be done only by Javascript?

  • Problem accessing session variable from jsp

    Hi!
    I get an error retrieving a session variable from inside a JSP declaration scriptlet....
    Something like this code in a JSP page:
    <%!
    public void funtion1() {
    String parameter1 = session.getAttribute("parameter1");
    %>I have seen that I have available getContextServer() method and from there I could call getAttribute("parameter1") . But the thing is that the attribute I want to retrieve was stored in session by another Jsp page.
    Any solutions are welcome
    Cheers
    Victor

    Appropriately the above is one the reasons also You cannot use JSP implicit objects from the declaration tag. However we can think of a small workaround by passing the reference like the one discussed below
    <%!public void funtion1(HttpSession session) {
    String parameter1 = session.getAttribute("parameter1").toString();
    }%>
    <% funtion1(session);%>Hope that helps :)
    REGARDS,
    RaHuL

  • Color in photoshop different then in aperture

    i had to notice that raw files adjusted in aperture always look different in photoshop...
    i work in a completely colormanaged environment and i really don't have any problems printing, but when i export files and open them in PS, there is a definite shift in color...
    i called apple about this and the answer was that aperture handles and displays color differently then PS does....even with the same colorprofile/space....which does not make a lot of sense to me and i really feel that this wasn't so pronounced a couple of months ago....now my adjustments (especially for skintones) in aperture are almost useless for PS....
    during my discussion with the apple tech i also found out that the "edit with PS" option always attaches adobe RGB as the profile, regardless of the setting in the prefs....to work in any other colorspace, one has to export and then manually open in PS....strange but not really a big problem, as long as one knows about it....
    what really worries me is the answer i got when i said that the files look very different in aperture and PS...that the 2 apps read and interpret color differently....isn't that what colorsync is all about? or at least should be?
    i am looking at my files in aperture using the "onscreen proofing" option set to the colorspace i work in....i have tried to export the same file in different spaces, all with the same result...a visible difference in PS (regardless of the PS working profile or PS soft proofing)....
    i am wondering if there is a way to corrupt my colorengine? with several software updates since 10.5 and this seems to get worse? any idea anyone? i keep a clean system and maintain it frequently (and not obsessively) and everything else works great....any input welcome...

    I think using the previews (as in quick preview mode) yields results that lie. When making all adjustments, I'm looking at the RAW file.
    I think some clarification is needed here for both of you to determine what is going on.
    1. Quick Preview Mode uses a jpeg preview that is embedded by the camera within the raw file. It's not "lying". It's just giving you the camera's version of things. Just like Aperture, ACR, DPP, Nikon Capture NX each have different color engines and will give different renderings of the same raw file - the same is happening here. The color and tone of Aperture's Quick Preview Mode is not going to match Aperture's rendering, it will only match the rendering of the OEM software that came with your camera. Quick Preview mode is no different than using something like Photo Mechanic.
    2. PSSSSS - your color should be matching between Aperture and a file exported into Photoshop but there are a many variables at play here and you need to pin them down to figure out what is going on.
    -I assume you are working on a calibrated display (one calibrated with a hardware device like an Xrite Display or Eye-one or similar). That's the only way to know that what you are seeing is accurate in either program.
    -For Aperture, make sure you are not in Quick Preview Mode and you do not have soft-proofing turned on.
    -For Photoshop, make sure you do not have "Proof Setup" turned on and in your Color Settings make sure that it is set to "Preserve Embedded Profiles".
    -With all three of the above done your color should match. If it does not there another possible issue I'm aware of and that is that Aperture is not compatible with certain kinds of display profiles. This goes back to 2006 and I don't know if it has been corrected. What I found then is that Aperture did not display images correctly if the display/monitor profile uses a "Large (LUT)" setting.
    Here's a thread going over that issue:
    http://discussions.apple.com/thread.jspa?threadID=469271&tstart=0
    I think certain screen calibration pucks like the Huey do use the "Large (LUT)" setting but do not let you know that or give you any other options.
    -One last possible issue, PSSSSS, is that your post lists a MacBook Pro as your computer. Are you using an external display? If not there could be an issue in MBP screen and/or its profile. How so? I've found that MBP screen, while the best to date, is still wanting. It can show images as noisy when they are not and it can show images as slightly posterized when they are not. I don't know if this affect is across the board or only within certain programs. For example, when I shoot tethered, my Canon 1DsM3 tethering to my MBP and using Canon's DPP software. The previews in the DPP can look noisy and a touch posterized, as I just mentioned, but the same files opened on my desktop Mac Pro/Apple Cinema Display look just fine.
    -In this thread, http://discussions.apple.com/message.jspa?messageID=7518140#7518140 , you mention "Show Master Image" or using the loupe shows a color shift in the image. I'm not seeing that at all on my system. If I remember correctly, this was part of the problem I saw when I found the display profile to be incompatible with Aperture (again, mentioned above).
    Jon Roemer
    http://www.jonroemer.com
    http://jonroemer.typepad.com/

  • Why is my iphone 4s 64GB serial number on the box different then the serial number on the phone?

    I just purchased a new Iphone 4s 64GB. I brought it to my carrier to have it activated. when I came home to register it with Apple, I noticed that the serial number on the box is different then the serial number on my Iphone. Why?

    When you bought the iPhone, was the box sealed?  Srink wrapped?  If not then the iPhone may have been changed.
    Have you tried to register the iPhone with Apple and does it come up clean, that is, not previously registered?

  • Time on Phones are Different Then System Time

    The time on the phones are different then the time on the system.  How do we force a sync?
    Here is the time on the phone
    Screenshot below of system time
    The system has been rebooted twice and still no resolution.

    Five reboots later the time is sync'd
    Sent from Cisco Technical Support iPhone App

  • Hi, when typing an email the font on the first line is different then the second, can you help fix this

    Hi, when typing an email the font on the first line is different then the second, can you help fix this

    I can offer suggestions, but I can not fix it.
    Press enter three or four times before you start typing and then move the cursor back to the start. What happens is your point of insertion gets outside your predefined font range, it is a know bug and that will help you "stay in the lines" Another option is type Rick, go back to the start and then type your message. Anything which keeps the insertion point from the very end of the email really.

Maybe you are looking for

  • Backup an external Drive

    Hello, i have a TimeCapsule and i have a external Drive via USB 3.0 on my MacMini. My wish is that the TimeCapsule also make a Backup from the Data witch is on my external drive. But this dosent work In the Menü "skip this folder" is always my extern

  • Error when using windows update to upgrade to build 10061

    When I use windows update to upgrade to Build 10061 it goes all the way through downloading but as soon as it gets to the installation it errors out.  The error code given is 8024201C.  Any help would be appreciated.

  • Manual for AIWA FD-N939YU AIWA A-3099922

    looking for a manual for AIWA A-3099922 - its a deck sysem with CD, Tape,Receiver and Equalizer - used for dubbing radio shows -  other indicating features is : PMN5B14 I just found the real model number -  AIWA FD-N939YU for the table top unit;  my

  • How can I define this FormBean in struts?

    I'm a new struts learner. I want to display a shopping cart to user, but the product items is dynamicly generated. Is it needed to define a formBean? If I use struts tags,......some ideas please. Thanks

  • A suspicious dialogue box is appearing on my Mac, with a checkbox for using searchmoose. How can I get rid of this?

    This morning when I booted up my MacBook Pro, I got a suspicious-looking dialogue box that says "Update Alert!" and something about downloading a utility in preparation for "the new version of OSX." A checkbox below offered searchmoose as my search e