*
The moose likes Other Application Frameworks and the fly likes Dynamically initialising bean properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Dynamically initialising bean properties" Watch "Dynamically initialising bean properties" New topic
Author

Dynamically initialising bean properties

Shasi Mitra
Ranch Hand

Joined: Nov 27, 2008
Posts: 101

I want to initialise my bean properties from some other bean. Like

<bean id="testVO" class="com.TestVO" scope= "request">
<property name = "name" >
<value>#{bean2.name}</value>
</property>
</bean>

Is it possible to get name from bean2 and put in testVO dynamically?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

No because the value of the variable you have is not set till runtime. Whereas the configuration is during development time, meaning you can't set a value in the configuration to a value that isn't set till runtime.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dynamically initialising bean properties
 
Similar Threads
Dynamic ACL's in Acegi.
mapping bean properties question
how to define multiple beans
unable to set attribute using <c:set> using the body
Setting property value of Bean dynamically through code.