File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 61451
    
  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: 18712
    
    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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How do I declare a bean that is a property of another bean?