• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Map Properties

 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

In my ActionForm i have a property, named attributes of type HashMap. The hashmap internally contains number of values objects. Those value objects actually contains what all type of UI element will be displayed on my JSP. Basically, we are dynamically generating our UI elements.

But the problem i am facing right now is when i put my form in session scope then everything works fine. I am able to access that hashmap attributes and also loop through the same. But, when i change the scope from 'session' to 'request' then i am not able to access that hashmap attributes and it throws me an error. See Below:

org.apache.commons.beanutils.NestedNullException: Null property value for 'attributes(urgency)'at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:669)at org.apache.commons.beanutils.BeanUtilsBean.getNestedProperty(BeanUtilsBean.java:698)at org.apache.commons.beanutils.BeanUtilsBean.getProperty(BeanUtilsBean.java:723)at org.apache.commons.beanutils.BeanUtils.getProperty(BeanUtils.java:265)at org.apache.struts.taglib.html.BaseHandlerTag.lookupProperty(BaseHandlerTag.java:949)at org.apache.struts.taglib.html.RadioTag.currentValue(RadioTag.java:198)

Can please someone tell me why i am not able to access the property in request scope.

Thanks
~Vineet
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this error occur when the page is being displayed or when the page is submitted? If it is when your page is submitted than it is a straight forward problem. A new instance of your form was created and all your properties are null (or whatever you initialize them to).

This like has some information on lazy loading of lists:
http://wiki.apache.org/struts/StrutsCatalogLazyList

- Brent
 
Sahil Sharma
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when the page is being displayed.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The most likely cause of this problem is that the action that prepares for the display of this JSP and the action that processes a submit of this JSP do not specify the same scope. Make sure that in the action mapping for both actions, a scope of request is specified.

It is also possible that you may be manually putting a populated ActionForm bean into session scope, but then trying to retrieve it from request scope.

This problem would also occur if you specified redirect="true" in the forward that forwards to this JSP.

Even if you get past this problem when the page is dispalyed, you're going to have the same problem when the page is submitted, so you still need to read the link that Brent gave you. An ActionForm in request scope gets re-instantiated when a form is submitted. That means you have to take steps to rebuild your map structure as well.
[ November 01, 2006: Message edited by: Merrill Higginson ]
 
Sahil Sharma
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanku Merrill. That was the problem. It has been solved now.
Thanks a ton!
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Though old post found it useful in solving the issue that I was having
 
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic