Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access beans from OGNL

 
E Robb
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic