But you don't have to do it twice. XML is 'eXtensible', meaning you can create user-defined entities(variables). I don't put my dsn in my Model-Glue or Mach-II xml file, I put it into my CS config.

<!DOCTYPE beans SYSTEM " coldspring.dtd"
[<!ENTITY dsn "myDSN">]
    >

Then I do
<contructor-arg name="dsn">
  <value>&dsn;</value>
</constructor-arg>

There may be better ways, but it boils down to I only have one place to define my datasource name.



On 4/21/06, Dave Ross <[EMAIL PROTECTED]> wrote:
While Sean mentions the *right* way to build an app, if
model.util.VerityController was coded that way and I couldn't change
it, my cs xml file would look like:

<bean id="Verity" class="model.util.VerityController " singleton="true">
         <constructor-arg name="collection">
                 <value>${verityCollection}</value>
         </constructor-arg>
</bean>
<bean id="Constants" class="model.util.Collection" singleton="true">
         <constructor-arg name="values">
                 <map>
                         <entry key="verityCollection">
                                 <value>${verityCollection}</value>
                         </entry>
                 </map>
         </constructor-arg>
</bean>

There's no reason to have your application constants hard-coded into
your xml file (but if you insist on doing it than you might as well do
it twice).

-Dave


On 4/21/06, Sean Corfield < [EMAIL PROTECTED]> wrote:
> Why not just inject the Constants bean into the Verity controller bean
> and let it call get("verityCollection") ?


Reply via email to