If you're out of Monorail I wouldn't use anything that belongs to Monorail, like NVelocityViewEngine. Instead, just use NVelocity's VelocityEngine. Some samples:
http://code.google.com/p/mausch/source/browse/trunk/StringInterpolation/StringInterpolation/StringExtensions.cs http://code.google.com/p/mausch/source/browse/trunk/WebMonitor/WebMonitor/Controller.cs On Oct 16, 5:28 pm, Daniel Hölbling <[email protected]> wrote: > Hi guys.I'm running a MonoRail application. But there is one HTTPHandler > that is running outside of MR, yet i'd still like to render a NVelocity > template as output. > > First I tried the obvious: > > var locator = new EngineContextLocator(); > IEngineContext context = locator.LocateCurrentContext(); > var writer = new StringWriter(); > if (context.Services.ViewEngineManager.HasTemplate("elms-login")) > { > context.Services.ViewEngineManager.Process("elms-lgin", "default", > writer, null); > > } > > return writer.ToString(); > > But the locator can't find a EngineContext, so I don't get access to the > ViewEngineManager :( > > Now I changed the code slightly trying to directly access the NV ViewEngine: > > public string GetTemplate(string templateName) > { > var engine = new NVelocityViewEngine(); > engine.Initialize(); > > var writer = new StringWriter(); > engine.Process("elms-login", "default", writer, null); > > return writer.ToString(); > } > > This also doesn't work since the ViewSourceLoader is not set properly, since > it's protected I can't set it to something. > > Any ideas on how to get NV to render my template without MR? > > greetings Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
