Ugh.  Using reflection in Velocity to create a new class is a pretty messy
kludge.  Would it be possible just to create a method in $util that loads
this, e.g. $util.getPropertyResourceBundle?

WILL



On 4/20/06, trad-ex <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I tried to load property resource bundle file, but failed to get an
> instance of FileInputStream.
> My code is below:
>
> #set( $fStreamClass = $util.class.forName("java.io.FileInputStream") )
> #set( $iStreamClass = $util.class.forName("java.io.InputStream") )
> #set( $stringClass = $util.class.forName("java.lang.String") )
> #set( $bundleClass
>      = $util.class.forName("java.util.PropertyResourceBundle") )
> #set( $userNameFilePath = $util.getPortalFile($userNameFile) )
> #set( $resStream
>      = $fStreamClass.getConstructor( [$stringClass] )
>        .newInstance( ["$userNameFile"] ) )
> #set( $resBundle
>      = $bundleClass.getConstructor( [$iStreamClass] )
>      .newInstance( [$resStream] ) )
>
> $util object is provided by our application to inject functionality into
> velocity context.
> I succeeded to get $fStreamClass & $iStreamClass & $bundleClass
> But I failed to get $resStream & $resBundle.
>
> My questions are:
> 1. Can I load the specific property file in Velocity context ?
> 2. What's wrong with my velocity script ?
>
> Best Regards, and thanks in advance.
> trad-ex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Forio Business Simulations

Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com

Reply via email to