aspose file tools*
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 Spring in Action this week in the Spring 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: 61428
    
  67

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: 18657
    
    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.
 
 
subject: How do I declare a bean that is a property of another bean?