velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: tools 1.4=>2.0 upgrade, configuration question
Date Wed, 25 Feb 2009 14:56:13 GMT
You could also just try extending the VelocityViewServlet, and
creating/configuring a VelocityEngine on your own in init() and doing
something like:

public void init(ServletConfig config) throws ServletException
{
    super.init(config);

    VelocityEngine myWay = new VelocityEngine();
    // configure it your way here...

    getVelocityView().setVelocityEngine(myWay);
}

You might lose a few log messages from the engine being replaced, but
that might not be a big deal to you.

On Wed, Feb 25, 2009 at 6:52 AM, Nathan Bubna <nbubna@gmail.com> wrote:
> Yes, if you need to programmatically manipulate the VelocityEngine
> properties, rather than set them via a velocity.properties file, this
> is still the way to go.
>
> You are sure you specified the org.apache.velocity.tools.view.class
> property in your init-params?  Can you share your code and config,
> perhaps i can spot a mistake that is not obvious to you.   Did you get
> any exceptions or log messages?  Make sure your VelocityView subclass
> has a constructor that accepts a JeeConfig object.
>
> On Mon, Feb 23, 2009 at 11:04 AM, rhild <rhild@yahoo.com> wrote:
>>
>> With 1.4 I could override the loadConfiguration method of VelocityViewServlet
>> to modify/add properties of the velocity configuration at runtime.  From a
>> previous post last year it seems the way to do this now is:
>>
>> http://www.nabble.com/Tools-2.0---VelocityLayoutServlet---loadConfiguration-td18268452.html
>>
>> When I try this approach the MyVelocityView class I created is not used. I
>> am setting up the init params for the servlet as indicated.
>>
>> Question: Does the link above still represent the best way to accomplish
>> what used to be done by overriding loadConfiguration() in
>> VelocityViewServlet?  If not, what would you recommend.
>>
>> thanks,
>>
>> -Ray
>>
>>
>> --
>> View this message in context: http://www.nabble.com/tools-1.4%3D%3E2.0-upgrade%2C-configuration-question-tp22167805p22167805.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message