Vishal Veda said: ... > Has anyone used the Velocity Struts toolset with VelocityEngine? I need > access to the MessageTool and LinkTool (to get to Struts actionmappings). (I > have access to the ServletContext - but not to Request and Response > objects - since this is offline processing).
hmm. i don't think you'll be able to use LinkTool or StrutsLinkTool without Request and Response objects. you'll need to either find a way to get a request and response to work with (dummy ones maybe?) or else you'll have to just copy/modify the relevant StrutsUtils and LinkTool code into some sort of OfflineStrutsLinkTool. but i think you would be ok using the MessageTool with just access to the ServletContext. you'll have to create your own implementation of the ViewContext interface that will return the ServletContext (for MessageTool it can return null for the other methods). then just create an instance of MessageTool and pass your ViewContext to the init(Object) method. however, i should note that without access to a request, the MessageTool will not be Locale-sensitive. you would need to extend MessageTool and override init(Object) to set the Locale you desire there somehow. > (I understand I could use the java.util package directly - but I'm looking > to promote consistency with other velocity templates that use the tools) yeah, consistency is good. > Has anyone tried to use the above mentioned tools in an application mode? > Any pointers are appreciated. i haven't, and i'll bet that you're the first. these tools are specifically designed and intended for request-based use. thus, trying to use them without a request is quite unorthodox. :) Nathan Bubna [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
