velocity 布局


	/**
	 * 模板viewResolver 
	 */
	@Bean
	public ViewResolver getViewResolver() {
		VelocityLayoutViewResolver resolver = new VelocityLayoutViewResolver();
		resolver.setSuffix(getViewSuffix());
		resolver.setContentType(DEFAULT_CONTENT_TYPE);
		resolver.setExposeRequestAttributes(true);
		resolver.setExposeSessionAttributes(true);
		resolver.setRequestContextAttribute(REQUEST_CONTEXT_ATTRIBUTE);
		resolver.setToolboxConfigLocation(getToolboxConfigLocation());
		resolver.setLayoutUrl("layout/master.vm");
		resolver.setOrder(0);
		return resolver;
	}


模板页面中用$screen_content获取内容
改变模板页面#set($layout="layout/empty.vm")
改变页面title #set($title="......"),再从模板页中取

你可能感兴趣的:(velocity)