aspose file tools*
The moose likes Struts and the fly likes How to access beans from OGNL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to access beans from OGNL" Watch "How to access beans from OGNL" New topic
Author

How to access beans from OGNL

E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
Im having problems accessing beans from OGNL. It always returns null in the view page. The setters & getters in the actions seem to be working fine when I do a System.out.print. Ill bet Ive tried 100 different ways to access the bean but it always fails. Can anyone shed any lite on this?


Struts.xml:


Action:


Bean Class:


The View:
E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
Just a quick clarification on what I am trying to accomplish here. I have a site that will have 3 parts for people. A person can be a candidate, client or a customer. All three people types will have the exact same setters / getters. So instead of writing setters / getters in all the Actions for all three person sections of the website I want 1 bean that contains all the setters and getters for a person.

Now the Action will create a new instance of the bean, set/get then the view will pull the values the action set. If I put my setters/getters in the Action the OGNL works fine on the view page. But if I try and have a common bean that is initialized from the action OGNL does not seem to want to pull the values set into the view.

thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access beans from OGNL
 
Similar Threads
Can getters/setters be seperated from the ActionSupport class with a bean?
Understanding public void prepare() +tiles
Struts action ognl setters and getters
Struts 2.1 javascript field validate
Struts & Hibernate Integration unable to delete values from MYSQL database