velocity

Configure velocity tools with spring 3.x

大兔子大兔子 提交于 2019-12-07 15:28:45
问题 I am new to both spring and velocity I want to configure velocity tools with spring 3.x but I could not find a good article on that + the velocity template is not showing the session variable I set from Spring controller 回答1: As for configuring Velocity tools in spring 3.x, first put your tools.xml file somewhere useful, eg: /WEB-INF/vm/toolbox.xml THEN configure your view resovler to look in that place: <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity

使用gulp解决Web项目中静态资源版本更新与缓存

房东的猫 提交于 2019-12-07 15:02:45
现在大部分项目还没做到完全的静态分离,想做到完全静态分离,后端和前端人员配比也相差不大。对于中小型公司,一般都前端工程师做出静态页面和相应的动画效果,页面的渲染还都是由后端工程师完成。项目打包也都是由后端工程师完成。 在版本更新的时候,涉及静态资源的更新经常会由于浏览器缓存、导致显示不正常。 解决这个问题的方法是每次有静态资源更新就加上版本号,让浏览器每次都去加载最新的文件 。如何更优雅的加版本号请参见文末链接。 解决思路: 这次我主要是基于原有项目结构,来解决静态资源版本更新。 现在的项目前端数据渲染主要采用 JSP 和 Velocity 模板引擎实现,项目打包使用 Maven 。 刚开始查了前端打包工具资料、Maven打包静态文件相关资料。不过没找到合适的解决方案,在找资料的过程中,我有了一点思路,因为目前项目打包是基于Maven,为了保持原有的打包流程,必定要通过Maven插件去完成。目前前端打包工具已经非常成熟了,所以不会自己去写相关Maven插件去处理静态文件。要通过Maven插件 将前端打包工具集成到 Maven打包流程中。 按着这个思路,后面找到了适合目前的解决方案: Maven + gulp + frontend-maven-plugin 在不影响原来项目的结构前提下,一个命令完成静态资源的版本更新。 clean package frontend:gulp 实现思路

How to obtain the languageid in a Liferay theme with velocity

試著忘記壹切 提交于 2019-12-07 14:11:53
问题 For the current theme im creating there are multiple images that require to change based on the current language. For example if the user is visiting the page in english we would load image_ languageid .jpg How can you replace languageid with the actual id of the language in velocity & liferay? Is this a good technique or is there a nicer one? 回答1: Try adding this line in init_custom.vm or portal_normal.vm #set ($language_id = $themeDisplay.getLanguageId()) 来源: https://stackoverflow.com

ros中move_group的参数动态设置

倾然丶 夕夏残阳落幕 提交于 2019-12-07 12:28:02
1、写一个配置文件 cfg/ElfinBasicAPIDynamicReconfigure.cfg #!/usr/bin/env python PACKAGE = "elfin_basic_api" from dynamic_reconfigure.parameter_generator_catkin import * gen = ParameterGenerator() gen.add("velocity_scaling", double_t, 0, "the max velocity scaling", 0.4, 0.01, 1.0) exit(gen.generate(PACKAGE, PACKAGE, "ElfinBasicAPIDynamicReconfigure")) 2、cmake自动产生 ElfinBasicAPIDynamicReconfigureConfig.h头文件 find_package(catkin REQUIRED COMPONENTS dynamic_reconfigure ) generate_dynamic_reconfigure_options( cfg/ElfinBasicAPIDynamicReconfigure.cfg ) 3、使用dynamic_reconfigure::Server #include <elfin_basic_api

springmvc源码解析MvcNamespaceHandler之视图配置器和跨域配置

独自空忆成欢 提交于 2019-12-07 11:57:26
说在前面 本次主要介绍springmvc配置解析<mvc:freemarker-configurer/>、<mvc:velocity-configurer/>、 <mvc:cors>。关注“天河聊技术”更多中间件源码解析。 springmvc配置解析 本次介绍MvcNamespaceHandler。 进入到这个方法org.springframework.web.servlet.config.FreeMarkerConfigurerBeanDefinitionParser#doParse @Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { // 解析template-loader-path属性值 List<Element> childElements = DomUtils.getChildElementsByTagName(element, "template-loader-path"); if (!childElements.isEmpty()) { List<String> locations = new ArrayList<String>(childElements.size()); for (Element

How to throw an user-defined exception from Velocity Template Script (VTL)?

二次信任 提交于 2019-12-07 07:46:18
问题 How to throw an user-defined exception from Velocity Template Script (VTL) ? From my velocity script, i need to throw an exception based on a condition, so that the caller can catch the exception and present an useful error messages to the end user. For Example. #if($passwordfield1 != $passwordfield2) throw an exception here #elseif($passwordfield1 == $passwordfield2) do something #end In the above example, if passwordfield1 and passwordfield2 is not matching,an appropriate exception should

Need a Java-based HTML prettifier to clean up Velocity-generated HTML

可紊 提交于 2019-12-07 06:28:45
问题 Web app I'm working on generates HTML using Velocity templates. Problem is that using whitespace in velocity templates and other formatting results in butt-ugly HTML (excessive whitespace, misalignment, etc.) Looking for a nice (single jar packaging would be nice) Java-based HTML prettifier to run over the generated HTML right before we dump it to the servlet response to make the source nicer to look at. Third party integrators would like to be able to glance at the HTML and know which

Build failure - Apache Parquet-MR source (mvn install failure)

那年仲夏 提交于 2019-12-07 01:06:16
问题 I am getting following error while trying to execute "mvn clean install" for building parquet-mr source obtained from https://github.com/apache/parquet-mr [INFO] Storing buildScmBranch: UNKNOWN [INFO] [INFO] --- maven-remote-resources-plugin:1.5:process (default) @ parquet-generator --- [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Apache Parquet MR ................................. SUCCESS [1.494s] [INFO] Apache Parquet

How to use VelocityLayoutViewResolver in spring-webmvc with velocity

让人想犯罪 __ 提交于 2019-12-06 21:46:33
<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver"> <property name="prefix" value="" /> <property name="suffix" value=".vm"></property> <property name="contentType" value="text/html;charset=UTF-8" /> <property name="layoutUrl" value="layout/default.vm" /> </bean> how the key word "layoutUrl" work in VelocityLayoutViewResolver? Its very common to have a dynamic web page divided into a layout part and a content part. The layout part might consist of a header, a footer, a sidebar, a navigation and so on. Elements meant to look more or less the

Java模版引擎:jsp、freemarker、velocity区别

孤街醉人 提交于 2019-12-06 19:39:04
在java领域,表现层技术主要有三种:jsp、freemarker、velocity。 jsp是大家最熟悉的技术 优点: 1、功能强大,可以写java代码 2、支持jsp标签(jsp tag) 3、支持表达式语言(el) 4、官方标准,用户群广,丰富的第三方jsp标签库 5、性能良好。jsp编译成class文件执行,有很好的性能表现 缺点: jsp没有明显缺点,非要挑点骨头那就是,由于可以编写java代码,如使用不当容易破坏mvc结构。 velocity是较早出现的用于代替jsp的模板语言 优点: 1、不能编写java代码,可以实现严格的mvc分离 2、性能良好,据说比jsp性能还要好些 3、使用表达式语言,据说jsp的表达式语言就是学velocity的 缺点: 1、不是官方标准 2、用户群体和第三方标签库没有jsp多。 3、对jsp标签支持不够好 freemarker 优点: 1、不能编写java代码,可以实现严格的mvc分离 2、性能非常不错 3、对jsp标签支持良好 4、内置大量常用功能,使用非常方便 5、宏定义(类似jsp标签)非常方便 6、使用表达式语言 缺点: 1、不是官方标准 2、用户群体和第三方标签库没有jsp多 选择freemarker的原因: 1、性能。velocity应该是最好的,其次是jsp,普通的页面freemarker性能最差