wood burning stoves 2.0*
The moose likes JSP and the fly likes How do I declare a bean that is a property of another bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How do I declare a bean that is a property of another bean?" Watch "How do I declare a bean that is a property of another bean?" New topic
Author

How do I declare a bean that is a property of another bean?

Thomas Kennedy
Ranch Hand

Joined: Jan 20, 2008
Posts: 137
In my view I have this


In my JSP I have this:


Of course I will replace the scriplet:


but it would be nice to do this instead:


How can I declare a bean that is itself a property of another bean?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

I think it's needless, but you can simply create a new scoped variable for foo in your controller. Though I don't see what the advantage is. In fact, it becomes less clear when you do that. I'd simply keep the original references.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18110
    
    8

I don't know about "declare"... you could certainly put the Foo object into request scope in your controller code identified as "foo", and then you could use

in your JSP.
 
Consider Paul's rocket mass heater.
 
subject: How do I declare a bean that is a property of another bean?
 
Similar Threads
how do i pass a bean object from one JSP page to another
Struts making me nuts :)
Unable to call Controller method after form submission using Spring MVC 3
logic:iterate problem
Javascript - Arraylist