当前位置: 首页>>代码示例>>Java>>正文


Java VelocityEngine.addProperty方法代码示例

本文整理汇总了Java中org.apache.velocity.app.VelocityEngine.addProperty方法的典型用法代码示例。如果您正苦于以下问题:Java VelocityEngine.addProperty方法的具体用法?Java VelocityEngine.addProperty怎么用?Java VelocityEngine.addProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.velocity.app.VelocityEngine的用法示例。


在下文中一共展示了VelocityEngine.addProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: postProcessVelocityEngine

import org.apache.velocity.app.VelocityEngine; //导入方法依赖的package包/类
/**
 * Provides a ClasspathResourceLoader in addition to any default or user-defined
 * loader in order to load the spring Velocity macros from the class path.
 * @see org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
 */
@Override
protected void postProcessVelocityEngine(VelocityEngine velocityEngine) {
	velocityEngine.setApplicationAttribute(ServletContext.class.getName(), this.servletContext);
	velocityEngine.setProperty(
			SPRING_MACRO_RESOURCE_LOADER_CLASS, ClasspathResourceLoader.class.getName());
	velocityEngine.addProperty(
			VelocityEngine.RESOURCE_LOADER, SPRING_MACRO_RESOURCE_LOADER_NAME);
	velocityEngine.addProperty(
			VelocityEngine.VM_LIBRARY, SPRING_MACRO_LIBRARY);

	if (logger.isInfoEnabled()) {
		logger.info("ClasspathResourceLoader with name '" + SPRING_MACRO_RESOURCE_LOADER_NAME +
				"' added to configured VelocityEngine");
	}
}
 
开发者ID:ghimisradu,项目名称:spring-velocity-adapter,代码行数:21,代码来源:VelocityConfigurer.java

示例2: sqlTemplateService

import org.apache.velocity.app.VelocityEngine; //导入方法依赖的package包/类
public static String sqlTemplateService(String template,Map paramMap,List placeList){
	VelocityEngine ve = new VelocityEngine();
	ve.addProperty("userdirective", "com.minxin.micro.template.vext.MicroSqlReplace");
	ve.init();
	VelocityContext context = new VelocityContext();
	context.put("param", paramMap);
	context.put("placeList", placeList);
	StringWriter writer = new StringWriter();
	ve.evaluate(context, writer, "", template);
	return writer.toString();
}
 
开发者ID:jeffreyning,项目名称:nh-micro,代码行数:12,代码来源:MicroServiceTemplateUtil.java

示例3: VelocityTemplate

import org.apache.velocity.app.VelocityEngine; //导入方法依赖的package包/类
/**
 * Create an instance.
 * @param header The fixed header
 * @param footer The fixed footer
 * @param row The template for the rows
 */
public VelocityTemplate(String header, String footer, String row) {
  super(header, footer);
  VelocityEngine engine = new VelocityEngine();
  engine.setProperty(Velocity.RESOURCE_LOADER, "string");
  engine.addProperty("string.resource.loader.class", StringResourceLoader.class.getName());
  engine.addProperty("string.resource.loader.repository.static", "false");
  engine.init();
  StringResourceRepository repository = (StringResourceRepository)engine.getApplicationAttribute(
      StringResourceLoader.REPOSITORY_NAME_DEFAULT);
  repository.putStringResource(TEMPLATE_NAME, row);
  template = engine.getTemplate(TEMPLATE_NAME);
}
 
开发者ID:Enterprise-Content-Management,项目名称:infoarchive-sip-sdk,代码行数:19,代码来源:VelocityTemplate.java

示例4: setUp

import org.apache.velocity.app.VelocityEngine; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
	game = new Game();
	game.setName("UnitTest Game");

	nf = new NotificationFormatter();
	nf.setBaseUrl("http://trivolous.com/unittest/");
	VelocityEngine ve = new VelocityEngine();
	ve.addProperty("resource.loader", "class");
	ve.addProperty("class.resource.loader.class",
			"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
	nf.setVelocityEngine(ve);

}
 
开发者ID:kenfrank,项目名称:trivolous,代码行数:15,代码来源:TestNotificationFormatter.java

示例5: MailTemplateVelocity

import org.apache.velocity.app.VelocityEngine; //导入方法依赖的package包/类
public MailTemplateVelocity(Mail mail) throws ResourceNotFoundException {
	String arquivoTemplate = mail.getTemplate();

	VelocityEngine engine = new VelocityEngine();
	engine.addProperty("resource.loader", "class");
	engine.addProperty("class.resource.loader.class",
			"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
	engine.init();

	Template template = engine.getTemplate(arquivoTemplate);

	NumberTool numberTool = new NumberTool();

	assert (numberTool != null);
	
	VelocityContext context = new VelocityContext(mail.getParametros());
	context.put("numberTool", numberTool);
	context.put("locale", Locale.getDefault());

	StringWriter writer = new StringWriter();

	template.merge(context, writer);

	htmlContent = writer.toString();
}
 
开发者ID:marcelothebuilder,项目名称:webpedidos,代码行数:26,代码来源:MailTemplateVelocity.java


注:本文中的org.apache.velocity.app.VelocityEngine.addProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。