Once solution to the problem is:

import org.apache.turbine.modules.layouts.VelocityECSLayout;
import org.apache.velocity.context.Context;
import org.apache.turbine.util.RunData;

RunData emailData = RunDataFactory.getRunData ( runData.getRequest(),
     runData.getResponse(), runData.getServletConfig());
Context emailContext = TurbineVelocity.getContext(emailData);
VelocityECSLayout vel = new VelocityECSLayout();
emailData.setLayout("Default");
emailData.setUser(runData.getUser());
emailData.setLayoutTemplate("Login.vm");
emailData.setScreen("Search");
emailData.setScreenTemplate("Search.vm");
vel.doBuild(emailData);
logger.debug(emailData.getPage().toString());


Brent Peckover wrote:


Within an action I am trying to build a template resulting in a String that I can use in the body of an email message that is being sent.

If I visit http://<server/webapps>/template/screen1.vm/action/requestverify

Within my RequestVerify.doPerform action I want to send an email that has the body
of screen2.vm and return a completed version of screen1.vm to the user's web browser.


My current approach is to create a new data object so that I don't corrupt the servlet based one:

RunData emailData = RunDataFactory.getRunData ( runData.getRequest(), runData.getResponse(), runData.getServletConfig());
Context emailContext = TurbineVelocity.getContext(emailData);
emailData.setScreenTemplate("Search.vm");


However I can't seem to get it to actually build the template.
  emailData.getPage().getBody().toString() returns an empty string.

I tried using the method that turbine uses to jump start the building process:

String defaultPage = TurbineTemplate.getService().getDefaultPageName(emailData);
PageLoader.getInstance().exec(emailData, defaultPage);


However getService() is designated protected access.

Any suggestions would be greatly appreciated.

Thanks,
Brent.





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to