`
liufei.fir
  • 浏览: 675919 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Spring MVC集成velocity扩展

阅读更多

1、扩展velocity的视图
[code="java"]package org.christ.matrix.template.velocity;

import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.velocity.Template;
import org.apache.velocity.context.Context;
import org.apache.velocity.tools.Scope;
import org.apache.velocity.tools.Toolbox;
import org.apache.velocity.tools.ToolboxFactory;
import org.apache.velocity.tools.config.XmlFactoryConfiguration;
import org.apache.velocity.tools.view.ViewToolContext;
import org.christ.matrix.template.TemplateVariable;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.support.ServletContextResource;
import org.springframework.web.servlet.view.velocity.VelocityToolboxView;

/**
* 扩展velocity的视图解析器。
*
* 自动匹配到Layout并扩展相关模板工具的Velocity视图。
*
* @author 刘飞 E-mail:liufei_it@126.com
* @version 1.0
* @since 2013-7-1 上午11:06:59
*/
public class VelocityTemplateLayoutView extends VelocityToolboxView implements DefaultVelocityConfigurer {

/** 模板文件的根路径目录 */
protected String templates = null;
/** screen模板解析的视图目录 */
protected String screen = null;
/** layout模板解析的视图目录 */
protected String layout = null;

/** velocity模板默认加载的layout模板 */
protected String defaultLayoutTemplate = null;
/** screen模板key */
protected String screenTemplateKey = null;

/** 本次请求对应的视图名称 */
protected String viewName = null;
/** 模板对应的扩展名称 */
protected String suffix = null;

protected List toolboxs = new ArrayList();

@Override
protected void doRender(Context context, HttpServletResponse response) throws Exception {
Template screenTemplate = getTemplate();
// 同名的layout
String layoutTemplateURL = SYSTEM_SEPARATOR + templates + SYSTEM_SEPARATOR + layout + SYSTEM_SEPARATOR
+ viewName + suffix;
Template layoutTemplate = safeLoadLayoutTemplate(layoutTemplateURL);
if (layoutTemplate == null) {// 默认的layout
layoutTemplateURL = SYSTEM_SEPARATOR + templates + SYSTEM_SEPARATOR + layout + SYSTEM_SEPARATOR
+ defaultLayoutTemplate;
layoutTemplate = safeLoadLayoutTemplate(layoutTemplateURL);
}
if (layoutTemplate == null) {// 没有找到layout就只解析screen
mergeTemplate(screenTemplate, context, response);
} else {
context.put(screenTemplateKey, templateRender(context, screenTemplate));
mergeTemplate(layoutTemplate, context, response);
}
}

@Override
protected Context createVelocityContext(Map model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
ViewToolContext context = new ViewToolContext(getVelocityEngine(), request, response, getServletContext());
context.putAll(model);

if (!CollectionUtils.isEmpty(toolboxs)) {// 注入模板工具
for (Toolbox toolbox : toolboxs) {
context.addToolbox(toolbox);
}
}

Map templateVariables = getApplicationContext().getBeansWithAnnotation(TemplateVariable.class);

if (templateVariables != null && templateVariables.size() > 0) {
for (Map.Entry e : templateVariables.entrySet()) {// 注入自定义工具
context.put(e.getKey(), e.getValue());
}
}

Map controls = getApplicationContext().getBeansOfType(
VelocityTemplateController.class, true, false);
if (controls != null && controls.size() > 0) {// 注入control
for (Map.Entry e : controls.entrySet()) {
String name = e.getKey();
VelocityTemplateController controller = e.getValue();
controller.setContext(context);
controller.setVelocityEngine(getVelocityEngine());
context.put(name, controller);
}
}

return context;
}

/**
* 初始化工作。
*
* @throws Exception
*/
protected void init() throws Exception {
if (StringUtils.isBlank(templates)) {
templates = DEFAULT_TEMPLATES;
}
if (StringUtils.isBlank(screen)) {
screen = DEFAULT_SCREEN;
}
if (StringUtils.isBlank(layout)) {
layout = DEFAULT_LAYOUT;
}

if (StringUtils.isBlank(defaultLayoutTemplate)) {
defaultLayoutTemplate = DEFAULT_LAYOUT_TEMPLATE;
}
if (StringUtils.isBlank(suffix)) {
suffix = DEFAULT_SUFFIX;
}
if (StringUtils.isBlank(screenTemplateKey)) {
screenTemplateKey = DEFAULT_SCREEN_TEMPLATE_KEY;
}

if (StringUtils.isNotBlank(getToolboxConfigLocation())) {
// 扩展使用velocity tools 2.0
try {
XmlFactoryConfiguration configuration = new XmlFactoryConfiguration();
ServletContextResource resource = new ServletContextResource(getServletContext(),
getToolboxConfigLocation());
configuration.read(resource.getURL());
ToolboxFactory factory = configuration.createFactory();
if (factory.hasTools(Scope.APPLICATION)) {
Toolbox applicationTool = factory.createToolbox(Scope.APPLICATION);
if (applicationTool != null) {
toolboxs.add(applicationTool);
}
}
if (factory.hasTools(Scope.REQUEST)) {
Toolbox requestTool = factory.createToolbox(Scope.REQUEST);
if (requestTool != null) {
toolboxs.add(requestTool);
}
}
if (factory.hasTools(Scope.SESSION)) {
Toolbox sessionTool = factory.createToolbox(Scope.SESSION);
if (sessionTool != null) {
toolboxs.add(sessionTool);
}
}
} catch (Exception e) {
logger.error(String.format("init toolbox [%s] error.", getToolboxConfigLocation()), e);
}
}
}

/**
* 安全的校验并获取layout模板。
*
* @param layoutURL
* @return
*/
protected Template safeLoadLayoutTemplate(String layoutURL) {
try {
return getTemplate(layoutURL);
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Loading Layout Template: " + layoutURL, e);
}
}
return null;
}

@Override
public final void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
try {
init();
} catch (Exception e) {
logger.error("VelocityTemplateLayoutView#init error.", e);
}
}

@Override
public boolean checkResource(Locale locale) throws Exception {

if (StringUtils.isBlank(templates)) {
if (logger.isErrorEnabled()) {
logger.error("Property 'templates' is required.");
}
throw new IllegalArgumentException("Property 'templates' is required.");
}
if (StringUtils.isBlank(screen)) {
if (logger.isErrorEnabled()) {
logger.error("Property 'screen' is required.");
}
throw new IllegalArgumentException("screen 'screen' is required.");
}
if (StringUtils.isBlank(layout)) {
if (logger.isErrorEnabled()) {
logger.error("Property 'layout' is required.");
}
throw new IllegalArgumentException("screen 'layout' is required.");
}

if (StringUtils.isBlank(defaultLayoutTemplate)) {
if (logger.isErrorEnabled()) {
logger.error("Property 'defaultLayoutTemplate' is required.");
}
throw new IllegalArgumentException("screen 'defaultLayoutTemplate' is required.");
}
if (StringUtils.isBlank(suffix)) {
if (logger.isErrorEnabled()) {
logger.error("Property 'suffix' is required.");
}
throw new IllegalArgumentException("screen 'suffix' is required.");
}
if (StringUtils.isBlank(screenTemplateKey)) {
if (logger.isErrorEnabled()) {
logger.error("Property 'screenTemplateKey' is required.");
}
throw new IllegalArgumentException("screen 'screenTemplateKey' is required.");
}

if (StringUtils.isBlank(viewName)) {
if (logger.isErrorEnabled()) {
logger.error("Property 'viewName' is required.");
}
throw new IllegalArgumentException("screen 'viewName' is required.");
}

return super.checkResource(locale);
}

/**
* 渲染一个模板。
*
* @param context
* @param template
* @return
*/
protected String templateRender(Context context, Template template) {
if (template == null || context == null) {
return null;
}
try {
StringWriter sw = new StringWriter();
template.merge(context, sw);
return sw.toString();
} catch (Exception e) {
logger.error(String.format("Template[%s] Render Error.", template.getName()), e);
}
return null;
}

/**
* @return the templates
*/
public String getTemplates() {
return templates;
}

/**
* @param templates
*            the templates to set
*/
public void setTemplates(String templates) {
this.templates = templates;
}

/**
* @return the screen
*/
public String getScreen() {
return screen;
}

/**
* @param screen
*            the screen to set
*/
public void setScreen(String screen) {
this.screen = screen;
}

/**
* @return the layout
*/
public String getLayout() {
return layout;
}

/**
* @param layout
*            the layout to set
*/
public void setLayout(String layout) {
this.layout = layout;
}

/**
* @return the defaultLayoutTemplate
*/
public String getDefaultLayoutTemplate() {
return defaultLayoutTemplate;
}

/**
* @param defaultLayoutTemplate
*            the defaultLayoutTemplate to set
*/
public void setDefaultLayoutTemplate(String defaultLayoutTemplate) {
this.defaultLayoutTemplate = defaultLayoutTemplate;
}

/**
* @return the viewName
*/
public String getViewName() {
return viewName;
}

/**
* @param viewName
*            the viewName to set
*/
public void setViewName(String viewName) {
this.viewName = viewName;
}

/**
* @return the suffix
*/
public String getSuffix() {
return suffix;
}

/**
* @param suffix
*            the suffix to set
*/
public void setSuffix(String suffix) {
this.suffix = suffix;
}

/**
* @return the screenTemplateKey
*/
public String getScreenTemplateKey() {
return screenTemplateKey;
}

/**
* @param screenTemplateKey
*            the screenTemplateKey to set
*/
public void setScreenTemplateKey(String screenTemplateKey) {
this.screenTemplateKey = screenTemplateKey;
}
}



2、扩展velocity模板解析器来完成上述的规约配置。
[code="java"]/**
* E-Mail : liufei_it@126.com, liufeiit@gmail.com, wb-liufei@taobao.com
* QQ : 970275153
*/
package org.christ.matrix.template.velocity;

import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.christ.matrix.template.TemplateViewResolver;
import org.springframework.beans.BeansException;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.core.io.ClassRelativeResourceLoader;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.ResourceLoader;
import org.springframework.web.context.support.ServletContextResourceLoader;
import org.springframework.web.servlet.view.AbstractUrlBasedView;
import org.springframework.web.servlet.view.velocity.VelocityViewResolver;

/**
* 模板视图布局规则:
*
* 指定模板文件的根路径目录,在该目录的子目录下指定一个目录作为screen模板解析的视图目录
*
* 在该目录的子目录下指定一个目录作为layout模板解析的视图目录
*
* 其余的子目录下的模板直接用其目录名称作为control对象直接引用即可。
*
* @author 刘飞 E-mail:liufei_it@126.com
* @version 1.0
* @since 2013-6-30 下午01:36:58
*/
public class VelocityTemplateLayoutViewResolver extends VelocityViewResolver implements TemplateViewResolver,
DefaultVelocityConfigurer {
/** 加载control模板文件的编码 */
protected String encoding = null;
/** 模板文件的根路径目录 */
protected String templates = null;
/** screen模板解析的视图目录 */
protected String screen = null;
/** layout模板解析的视图目录 */
protected String layout = null;

/** velocity模板默认加载的layout模板 */
protected String defaultLayoutTemplate = null;
/** screen模板key */
protected String screenTemplateKey = null;

/** 资源加载器。 */
protected ResourceLoader resourceLoader = new DefaultResourceLoader();
/** {@link #templates} 下的control目录 */
protected final List controls = new ArrayList();

/** velocity模板contentType */
protected String contentType = null;
/** 约定:模板缓存上限,为-1的时候表示关闭,不配置的话默认是2048 */
protected Integer cacheLimit = null;

@Override
protected Class> requiredViewClass() {
return VelocityTemplateLayoutView.class;
}

@Override
protected AbstractUrlBasedView buildView(String viewName) throws Exception {
VelocityTemplateLayoutView view = VelocityTemplateLayoutView.class.cast(super.buildView(viewName));
view.setCacheTemplate(true);
view.setContentType(contentType);
view.setTemplates(templates);
view.setScreen(screen);
view.setLayout(layout);
view.setEncoding(encoding);
view.setViewName(viewName);
view.setSuffix(getSuffix());
view.setScreenTemplateKey(screenTemplateKey);
view.setDefaultLayoutTemplate(defaultLayoutTemplate);
return view;
}

protected void controlBeanRegistry(BeanDefinitionRegistry registry) throws Exception {
if (controls == null || controls.isEmpty()) {
logger.debug("没有control需要配置.");
return;
}
for (File controlFile : controls) {
String absolutePath = controlFile.getAbsolutePath();
String name = controlFile.getName();
try {
RootBeanDefinition controlBean = getDefaultRootBeanDefinition(VelocityTemplateController.class,
"模板引擎扩展的control:" + name);
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.addPropertyValue("encoding", encoding);
/** 将control的绝对路径赋予 */
propertyValues.addPropertyValue("control", SYSTEM_SEPARATOR + templates + SYSTEM_SEPARATOR + name
+ SYSTEM_SEPARATOR);
controlBean.setPropertyValues(propertyValues);
registry.registerBeanDefinition(name, controlBean);
logger.error(String.format("Registry control Named[%s] for template directory[%s] success.", name,
absolutePath));
} catch (Exception e) {
logger.error(String.format("Registry control Named[%s] for template directory[%s] error.", name,
absolutePath));
}
}
}

@Override
public void afterPropertiesSet() throws Exception {
if (StringUtils.isBlank(templates)) {
templates = DEFAULT_TEMPLATES;
}
if (StringUtils.isBlank(screen)) {
screen = DEFAULT_SCREEN;
}
if (StringUtils.isBlank(layout)) {
layout = DEFAULT_LAYOUT;
}
if (StringUtils.isBlank(encoding)) {
encoding = DEFAULT_ENCODING;
}

if (StringUtils.isBlank(defaultLayoutTemplate)) {
defaultLayoutTemplate = DEFAULT_LAYOUT_TEMPLATE;
}
if (StringUtils.isBlank(screenTemplateKey)) {
screenTemplateKey = DEFAULT_SCREEN_TEMPLATE_KEY;
}

if (StringUtils.isEmpty(contentType)) {
contentType = DEFAULT_CONTENT_TYPE;
}

if (StringUtils.isBlank(getSuffix())) {//默认配置
setSuffix(DEFAULT_SUFFIX);
}

setPrefix(SYSTEM_SEPARATOR + templates + SYSTEM_SEPARATOR + screen + SYSTEM_SEPARATOR);// 设置prefix

if (cacheLimit == null) {
cacheLimit = CACHE_LIMIT;
}
if(cacheLimit != null && cacheLimit > 0) {
setCacheLimit(cacheLimit);
setCache(true);
} else {
setCache(false);
}

try {
/** 模板根路径 */
File templates = getTemplatesSource(SYSTEM_SEPARATOR + this.templates + SYSTEM_SEPARATOR);
if (templates != null && templates.isDirectory()) {
/** 过滤根路径下的control目录 */
File[] controlTemplates = templates.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
if (StringUtils.equalsIgnoreCase(name, screen) || StringUtils.equalsIgnoreCase(name, layout)) {
return false;
}
return true;
}
});
if (ArrayUtils.isNotEmpty(controlTemplates)) {
controls.addAll(Arrays.asList(controlTemplates));
}
}
} catch (Exception e) {
logger.error("加载control异常", e);
}
}

/**
* 获取模板根路径文件。
*
* @param templates
* @return
*/
protected File getTemplatesSource(String templatesPath) {
File templates = null;
try {
templates = resourceLoader.getResource(templatesPath).getFile();
if(templates != null) {
return templates;
}
} catch (Exception e) {
logger.warn(String.format("[%s] trying loading resource [%s] failure.", resourceLoader.getClass().getSimpleName(), templatesPath), e);
}
try {
templates = new ServletContextResourceLoader(getServletContext()).getResource(templatesPath).getFile();
if(templates != null) {
return templates;
}
} catch (Exception e) {
logger.error(String.format("[%s] trying loading resource [%s] failure.", ServletContextResourceLoader.class.getSimpleName(), templatesPath), e);
}
try {
templates = new ClassRelativeResourceLoader(getClass()).getResource(templatesPath).getFile();
if(templates != null) {
return templates;
}
} catch (Exception e) {
logger.error(String.format("[%s] trying loading resource [%s] failure.", ClassRelativeResourceLoader.class.getSimpleName(), templatesPath), e);
}

logger.error(String.format("trying loading resource [%s] failure.", templatesPath));
return null;
}

/**
* 在这里将注入和各个目录对应的control
*/
@Override
public final void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
try {
if (beanFactory instanceof BeanDefinitionRegistry) {
controlBeanRegistry(BeanDefinitionRegistry.class.cast(beanFactory));
} else {
logger.warn("ConfigurableListableBeanFactory can't be cast to BeanDefinitionRegistry.");
}
postProcessBeanFactory0(beanFactory);
} catch (Exception e) {
logger.error("注入和各个目录对应的control异常", e);
}
}

/**
* 基础的RootBeanDefinition定义。
*
* @param clazz
* @param description
* @return
*/
protected RootBeanDefinition getDefaultRootBeanDefinition(Class> clazz, String description) {
RootBeanDefinition beanDefinition = new RootBeanDefinition(clazz);
beanDefinition.setAbstract(false);
beanDefinition.setAutowireCandidate(true);
beanDefinition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
beanDefinition.setDependencyCheck(AbstractBeanDefinition.DEPENDENCY_CHECK_NONE);
beanDefinition.setDescription(description);
beanDefinition.setLazyInit(false);
beanDefinition.setScope(AbstractBeanDefinition.SCOPE_SINGLETON);
return beanDefinition;
}

protected void postProcessBeanFactory0(ConfigurableListableBeanFactory beanFactory) throws Exception {
}

@Override
public void setTemplates(String templates) {
this.templates = templates;

}

@Override
public void setScreen(String screen) {
this.screen = screen;
}

@Override
public void setLayout(String layout) {
this.layout = layout;

}

/**
* @param resourceLoader
*            the resourceLoader to set
*/
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
}

/**
* @param encoding
*            the encoding to set
*/
public void setEncoding(String encoding) {
this.encoding = encoding;
}

/**
* @return the defaultLayoutTemplate
*/
public String getDefaultLayoutTemplate() {
return defaultLayoutTemplate;
}

/**
* @param defaultLayoutTemplate
*            the defaultLayoutTemplate to set
*/
public void setDefaultLayoutTemplate(String defaultLayoutTemplate) {
this.defaultLayoutTemplate = defaultLayoutTemplate;
}

/**
* @return the screenTemplateKey
*/
public String getScreenTemplateKey() {
return screenTemplateKey;
}

/**
* @param screenTemplateKey
*            the screenTemplateKey to set
*/
public void setScreenTemplateKey(String screenTemplateKey) {
this.screenTemplateKey = screenTemplateKey;
}

/**
* @return the encoding
*/
public String getEncoding() {
return encoding;
}

/**
* @return the templates
*/
public String getTemplates() {
return templates;
}

/**
* @return the screen
*/
public String getScreen() {
return screen;
}

/**
* @return the layout
*/
public String getLayout() {
return layout;
}

/**
* @return the resourceLoader
*/
public ResourceLoader getResourceLoader() {
return resourceLoader;
}
}


重新定义的解析器接口
[code="java"]/**
* E-Mail : liufei_it@126.com, liufeiit@gmail.com, wb-liufei@taobao.com
* QQ : 970275153
*/
package org.christ.matrix.template;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;

/**
* 模板视图布局规则:
*
* 指定模板文件的根路径目录,在该目录的子目录下指定一个目录作为screen模板解析的视图目录
*
* 在该目录的子目录下指定一个目录作为layout模板解析的视图目录
*
* 其余的子目录下的模板直接用其目录名称作为control对象直接引用即可。
*
* @author 刘飞 E-mail:liufei_it@126.com
* @version 1.0
* @since 2013-6-30 上午11:58:41
*/
public interface TemplateViewResolver extends BeanFactoryPostProcessor, InitializingBean {

/**
* 指定模板文件的根路径目录.
*
* @param templates
*/
void setTemplates(String templates);

/**
* 指定{@link #setTemplate(String)}一个目录作为screen模板解析的视图目录.
*
* @param screen
*/
void setScreen(String screen);

/**
* 指定{@link #setTemplate(String)}一个目录作为layout模板解析的视图目录
*
* @param layout
*/
void setLayout(String layout);
}






分享到:
评论
1 楼 bitray 2013-12-12  
帅哥,还是用spring的配置文件简单的配一下吧。这个真的很复杂啊

相关推荐

    spring mvc 3.2 参考文档

    您可以直接与基于呈现技术的模板 (如 JSP、 Velocity和 Freemarker )集成或直接生成 XML、 JSON、 Atom和许多其他类型的内容。模型map被转化为合适的格式,如JSP request attributes或是 Velocity template model。

    spring4.3.9相关jar包

    spring-context.jar(必须):这个jar 文件在基础IOC功能上为Spring 核心提供了大量扩展服务,此外还提供许多企业级服务的支持,有邮件服务、任务调度、JNDI定位,EJB集成、远程访问、缓存以及多种视图层框架的支持...

    spring jar 包详解

    可以找到使用Spring ApplicationContext特性时所需的全部类,JDNI所需的全部类,UI方面的用来与模板(Templating)引擎如 Velocity、FreeMarker、JasperReports集成的类,以及校验Validation方面的相关类。...

    Spring 2.5 jar 所有开发包及完整文档及项目开发实例

    可以找到使用Spring ApplicationContext特性时所需的全部类,JDNI所需的全部类,UI方面的用来与模板(Templating)引擎如 Velocity、FreeMarker、JasperReports集成的类,以及校验Validation方面的相关类。...

    spring4.1核心包

    15. spring-test-4.1.1.RELEASE.jar 支持Spring组建JUnit和TestNG的单元测试和集成测试。 16. spring-tx-4.1.1.RELEASE.jar 17. spring-web-4.1.1.RELEASE.jar 包含Web应用开发时,用到Spring框架时所需的核心类,...

    最新最全的spring开发包

    可以找到使用Spring ApplicationContext特性时所需的全部类,JDNI所需的全部类,UI方面的用来与模板(Templating)引擎如 Velocity、FreeMarker、JasperReports集成的类,以及校验Validation方面的相关类。...

    Spring 2.0 开发参考手册

    2.5.1. Spring MVC的表单标签库 2.5.2. Spring MVC合理的默认值 2.5.3. Portlet 框架 2.6. 其他特性 2.6.1. 动态语言支持 2.6.2. JMX 2.6.3. 任务规划 2.6.4. 对Java 5(Tiger)的支持 2.7. 移植到Spring ...

    Spring-Reference_zh_CN(Spring中文参考手册)

    2.5.1. Spring MVC的表单标签库 2.5.2. Spring MVC合理的默认值 2.5.3. Portlet 框架 2.6. 其他特性 2.6.1. 动态语言支持 2.6.2. JMX 2.6 .3. 任务规划 2.6.4. 对Java 5(Tiger)的支持 2.7. 移植到Spring 2.0 ...

    Spring中文帮助文档

    2.5.1. Spring MVC合理的默认值 2.5.2. Portlet 框架 2.5.3. 基于Annotation的控制器 2.5.4. Spring MVC的表单标签库 2.5.5. 对Tiles 2 支持 2.5.6. 对JSF 1.2支持 2.5.7. JAX-WS支持 2.6. 其他 2.6.1. 动态...

    spring chm文档

    2.5.2. Spring MVC合理的默认值 2.5.3. Portlet 框架 2.6. 其他特性 2.6.1. 动态语言支持 2.6.2. JMX 2.6.3. 任务规划 2.6.4. 对Java 5(Tiger)的支持 2.7. 移植到Spring 2.0 2.7.1. 一些变化 2.8. 更新的...

    Spring API

    2.5.1. Spring MVC合理的默认值 2.5.2. Portlet 框架 2.5.3. 基于Annotation的控制器 2.5.4. Spring MVC的表单标签库 2.5.5. 对Tiles 2 支持 2.5.6. 对JSF 1.2支持 2.5.7. JAX-WS支持 2.6. 其他 2.6.1. 动态...

    springboot参考指南

    关闭Spring MVC DispatcherServlet vii. 65.7. 关闭默认的MVC配置 Spring Boot参考指南 7 viii. 65.8. 自定义ViewResolvers v. 66. 日志 i. 66.1. 配置Logback ii. 66.2. 配置Log4j i. 66.2.1. 使用YAML或JSON配置...

    java web 开发详解

     优点: 对覆盖绑定(overriding binding)、验证(validation)等提供生命周期管理 与许多表示层技术/框架无缝集成:JSP/JSTL、Tiles、Velocity、FreeMarker、Excel、XSL、PDF 等 便于测试——归功于IoC 缺点: ...

    JessMA Java Web 应用开发框架 (v3.2.2-20130815).pdf

    JessMA Java MVC & REST应用开发框架(简称 JessMA)是一套功能完备的高性能Full-Stack Web应用开发框架,内置稳定高效的MVC基础架构和DAO框架(已内置Hibernate、MyBatis和JDBC支持),集成 Action拦截、Form Bean ...

    Java Web程序设计教程

    14.1.1struts2应用的扩展方式 277 14.1.2spring插件的应用 278 14.2spring和hibernate的整合 279 14.2.1spring对hibernate的支持 279 14.2.2管理sessionfactory 279 14.2.3hibernate的dao实现 281 14.2.4使用...

    单点登录源码

    Spring+SpringMVC+Mybatis框架集成公共模块,包括公共配置、MybatisGenerator扩展插件、通用BaseService、工具类等。 > zheng-admin 基于bootstrap实现的响应式Material Design风格的通用后台管理系统,`zheng`...

    基于jbpm与activiti的工作流平台技术架构介绍

    2.Spring MVC 3.0 3.Spring Security 3.0.5 4.Spring AOP 3.0.4 5.Apache Active MQ 5.5 6.MyBatis 3 7.CKEditor 3.6 8.JQuery 1.8 9.CXF 2.0 10.Alfresco Activiti 5.8 11.Compass + Lucene 12.JasperReport 4.5 13...

    Struts2 in action中文版

    第9章 集成Spring和Hibernate/JPA 196 9.1 为什么在Struts 2中使用Spring 196 9.1.1 依赖注入能做些什么 197 9.1.2 Spring如何管理对象和注入依赖 199 9.1.3 使用接口隐藏实现 200 9.2 将Spring添加到Struts 2 202 ...

Global site tag (gtag.js) - Google Analytics