Discussions

Web tier: servlets, JSP, Web frameworks: request.set/getAttribute not working in Weblogic 6.1

  1. request.set/getAttribute not working in Weblogic 6.1 (2 messages)

    Hi all!

    I am setting objects in request using methods 'request.setAttribute' and access it through forwarded JSP using 'request.getAttribute' method.

    This approach is working fine on Orion server, but when I deployed same application on Weblogic 6.1, 'request.getAttribute' return 'null'.

    Just to check I called 'request.getAttribute' immediately after doing 'request.setAttribute' and I found that there also I am getting 'null' value. I am sure that I am passing non-null value to 'request.setAttribute' (because I have logged it!).

    Have Weblogic people implemented set/getAttribute APIs of 'request' (i.e. ServletRequest)?

    Any help regarding this will be very helpful for me.
  2. I know that this behaviour works fine in WebLogic 5.1.0. I've never tried 6.1, but I can't see why they would change it. Perhaps if you post your code that puts and retrieves your object. Also, what kind of object are you putting in the request? Is it serializable? What are you using as the key for your object? Does it implement hashCode()?

    Andy
  3. This is the code which puts and retrieves the attribute...

    LogManager.log(FLOW, LC_NAME, LM_NAME, "Setting root in attribute (" + SE_SELECTOR + "):" + oRoot
    + ", of:" + request);
    request.setAttribute(SE_SELECTOR, oRoot);
    LogManager.log(FLOW, LC_NAME, LM_NAME, "Check root in attribute (" + SE_SELECTOR + "):" + request.getAttribute(SE_SELECTOR));

    oRoot is object of 'org.jdom.Element' class that ships with JDOM (beta6). It implements Serializable interface, so the object should be serializable.

    Do I need to do any additional settings (may be in web.xml/weblogic.xml or something)?