• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Form Bean scope problem

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am facing a weird problem with struts. I have a link on the first page of my application, clicking on which I invoke a action class. It connects to database, pulls out data populates a form bean and forwards to a jsp.

In the jsp, I am accessing the properties of the form bean and I am displaying. But when I run the same, all the values displayed are empty. However logs at action classes convey that data was fetched from database and is set into the form bean. I have set the scope of the bean to be request.

Any guess what could be the problem?

Regards,
Hari
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question is better suited for Struts forum.


In the jsp are you getting the bean or you are getting the bean without the values?
Note : If the bean doesn't not exits , then its creates one.What I guess is you are setting the bean in one scope and then trying to retrieve it back from some other scope , that might be the reason that you are getting the bean and not the values.

You can even look at the serverts which is being created out of your jsp for seeing as what actually is going.
 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Java Buzz", you have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr. Buzz:

Are you instantiating a new instance of your Action Form in your action code or are you using the form passed in as a parameter to the execute method? If you are instantiating a new form, then you have to save it as a request attribute with the same name defined in struts-config. A better option might be to change your action mapping and use the form passed in.

- Brent
 
reply
    Bookmark Topic Watch Topic
  • New Topic