Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

JSP Session Scope, HttpSessionAttributeListener

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Given:
<jsp:useBean id="BoltsBean" class="parts.BoltsBean" scope="session" />
<jsp:setProperty name="BoltsBean" property="*" />
I seem to have the appropriate setters and getters in the BoltsBean class. From this jsp page I <jsp:forward /> to another page which does <jsp:getProperty /> on one of the named properties and it displays the value properly.
I also have a HttpSessionAttributeListener configured in the web.xml file. The attributeAdded method is notified and I seem to be able to retrieve the BoltsBean object by
public void attributeAdded(HttpSessionBindingEvent se) {
HttpSession hs = se.getSession();
String name = se.getName();
BoltsBean bb = (BoltsBean)hs.getAttribute(name);
At this point bb is not equal null(I checked), however if I try and do the getter method on the property the method returns null.
Any Ideas ???
 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if your bean returned ok from session, the problem seems to be somewhere in its method
you try to get. it's hard to say where exactly, so if you want, publish your bean's and jsp's code.
 
jr gil
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will look at that part of it a little closer and see if I see anything. Thanks for the reply !!!
 
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic