Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.3
-
Fix Version/s: 2.4.2
-
Component/s: Displayers
-
Labels:None
Description
Copied from SF http://sourceforge.net/tracker/index.php?func=detail&aid=934474&group_id=48726&atid=453974:
the Velocity displayer should use a VelocityEngine
instance instead of the singleton Velocity. Otherwise,
it may conflict with other usage of Velocity in the
application.
Comments
Date: 2004-11-18 06:23
Sender: uded
Logged In: YES
user_id=126964
Really sorry, missed one more:
-122: t = Velocity.getTemplate(template);
+122: t = velocityInstance.getTemplate(template);
Date: 2004-11-18 04:12
Sender: uded
Logged In: YES
user_id=126964
Got one, see below:
Add field:
/**
- Velocity instance for running the template against
*/
private VelocityEngine velocityInstance;
And then:
57+: velocityInstance = new VelocityEngine();
60-: Velocity.setApplicationAttribute(SERVLET_CONTEXT_KEY,
pageContext.getServletContext());
60+:
velocityInstance.setApplicationAttribute(SERVLET_CONTEXT_KEY,
pageContext.getServletContext());
63-: Velocity.setProperty(RuntimeConstants.RESOURCE_LOADER,
"webapp");
64-: Velocity.setProperty("webapp.resource.loader.class",
WebappLoader.class.getName());
63+:
velocityInstance.setProperty(RuntimeConstants.RESOURCE_LOADER,
"webapp");
64+:
velocityInstance.setProperty("webapp.resource.loader.class",
WebappLoader.class.getName());
89-: Velocity.init(props);
89+: velocityInstance.init(props);
Date: 2004-09-21 21:27
Sender: wrschneider99
Logged In: YES
user_id=768885
you're right, it's not a showstopper. So long as
you're
aware that VelocityMenuDisplayer uses the Velocity
singleton, you just need to know who "wins" by
calling
Velocity.init(props) first. If struts-menu wins, you have
to make sure that you have
WEB-INF/classes/velocity.properties and that it includes
whatever the rest of your app needs. If something else
wins, whatever properties that uses have to also include any
templates that struts-menu will use.
I'll have to get back to you with a patch, since I
haven't
had to build it from source yet. ![]()
Date: 2004-09-21 16:41
Sender: mraibleProject Admin
Logged In: YES
user_id=226669
I've used the VelocityDisplayer in other applications with
Velocity and everything seemed to work OK. Do you have a
patch for this? I tried creating a VelocityEngine class
variable, using it in the init and displayComponents
methods, but then I kept getting the following error that I
hadn't before:
log4j:ERROR Attempted to append to closed appender named [null].
Activity
| Field | Original Value | New Value |
|---|---|---|
| Attachment | VelocityMenuDisplayer.patch [ 10166 ] |
| Fix Version/s | 2.4.2 [ 10091 ] | |
| Fix Version/s | 2.5 [ 10070 ] |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |