", as the storage path//here with for (int i=1;i Five, Tool class Package Com.geenk.web.velocity_engine;import Org.apache.velocity.template;import Org.apache.velocity.velocitycontext;import Org.apache.velocity.app.velocity;import Org.slf4j.Logger;import Org.slf4j.loggerfactory;import Java.io.bufferedwriter;import Java.io.file;import Java.io.FileOutputStream;import Java.io.outputstreamwriter;import java.util.properties;/** * @author duchong * @since 2018-04-28 18:35 **/public class Ge nerateh
Of course, looking for cases of the big people generally want to go directly to a case on the line, not a lot of time to read a lot of text, so not long-winded.
One of course first to download velocity required jar bag, everywhere there are downloads of course I'm going to the official download, after all, the official things are generally more formal
To say the Apache official, think of just start out to work in the basic daily in the official Apac
(Do not use this template, the latest version of spring boot is not supported.) Use Freemarker bar: http://blog.csdn.net/clementad/article/details/51942629)
In a few simple steps, use the velocity template to generate text in spring boot:
1. Introduction of Dependency
2. Create templates directory in Resources
3. Create a. VM template file Welcome.vm:
4, use the template, test cases:
@Autowired
velocityengine velocityengine;
The velocity project is an application platform for distributed caching, providing support for developing scalability, available, high-performance applications, Vekicity provides a unified cache for applications using multiple computers, and a specific introduction to velocity is available in the vekicity Team blog:http://blogs.msdn.com/velocity/default.aspx,
Velocity vs. JSP, FreemarkerIn the Java field, there are three main performance layer technologies: JSP, Freemarker, Velocity.JSP is the most familiar technology of everyoneAdvantages:1. Powerful function, can write Java code2. Support JSP tag (JSP tag)3. Support Expression language (EL)4, the official standard, a wide range of users, a wealth of third-party JSP Tag Library5, good performance. JSP compiled into class file execution, good performanceDi
Velocity Seventh Application Example----Assignment in a template
2 Create a context Objectvelocitycontext context = Newvelocitycontext ();//3 Add you data object to this CONTEXTCONTEXT.P UT ("name", "Old Bi");//4 Choose a templatetemplate template =velocity.gettemplate ("TEMPLATE7.VM");//5 Merge the template and You data toproduce the outputstringwriter SW = new StringWriter (); Template.merge (context, SW); Sw.flush (); System.out.println (Sw.tost
Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming...
Velocity 5 application example-get the index of the current iteration
# Foreach ($ key in $ map. k
You can write a tool class and put the tool class into context. in the template, you can directly call the method extension function of the tool class. you can write a tool class and then place the tool class in context, you can directly call the tool class method in the template.
By default, the Tue output by date
Jul 14 16:42:30 CST 2015
We need to write a tool class to format the date,
Add the original date and date formatting tool class to the context
In the template, call the date forma
The introduced JAR package:1 Import org.apache.velocity.Template; 2 Import Org.apache.velocity.VelocityContext; 3 Import org.apache.velocity.app.Velocity; 4 Import Org.apache.velocity.app.VelocityEngine; 5 Import Org.apache.velocity.tools.generic.DateTool; 6 import Org.apache.velocity.tools.generic.NumberTool;Jar package can be downloaded to the official websitehttp://velocity.apache.org/engine/devel/Sample code:1 /**2 * Generate VMS3 * @paramVmpackage The package name where the VM resides4
When the cache cluster is configured, start the service named Microsoft Project code named "velocity" in Windows Services. This service will not be automatically started by default.
1. Set the volocityProgramCopy the set to the development machine. The Assembly is located in the velocity installation directory. The Assembly is as follows:
Cachebaselibrary. dll,
Clientlibrary. dll,
Fabriccomm
By reading some velocity documents, you can write down what you see as a simple and unsystematic note, which enhances your memory.Dynamic Language features:
A Dynamic Language requires an interpreter, which is generally on the server.MVC
Model: Indicates the status of the system and application, which is generally a class or other data structure. Can change the system statusActionsAndMethod. TypicalJavabean. The original intention is to separate data
The Java code called in velocity is invalid or cannot be debugged.
The standard way velocity calls Java code is as follows:
$! {Classname. staticMethod ()} or $! {Objectname. instanceMethod ()}
For example:
$! {Salehelper. isWltUser ($ info. getCateID (), $ info. getUserID ())}
This code belongs to the type of the instance method called by the object. There are two points to note:
1. The syntax format
[Author: Sun Li link: http://www.cnblogs.com/sunli/ updated on:]
We are very honored to share the architecture and Performance Optimization of the mobile Internet content platform at this velocity china 2010 Conference. Click here to download the pdf version of the ppt. Since a large number of friends did not go to the site, they could not fully express what I meant in the PPT, so I wrote this blog for some text instructions. If you have any questions
Velocity CheckingForNull, checkingfornull
Q: I want to check for null, something like this:
#if ($car.fuel == null)
A: There are several approaches. Select the one most suitable depending on what you really want to do.
Approach 1:Use the fact that null is evaluated as a false conditional. (cf. http://velocity.apache.org/engine/devel/user-guide.html#Conditionals)
#if( ! $car.fuel )
Note:The conditional will also pass if the result of $ car. fuel is t
Tags: HDU mathematics
Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 3128
Problem description
What is the air speed velocity...
... Of a fully laden swallow? This fearful question was posed to the intrepid band of Grail searchers. Their response of "African or European? "Was partly correct. the air speed wowould most definitely depend on the sub-species of swallow. king Arthur, fearing more intense questioning in
repeatedly. The relationship between the predictive equation and the renewal equation is shown in Figure 3-3.
This is the Intercept. The application of Kalman filter to the fusion of gyroscope and accelerometer is an explanation of Kalman filter, according to the interpretation of the article and some matrix theory (matrix multiplication, covariance matrix, etc.) with the knowledge of the above 5 equations, you can understand the entire derivation process, the final programming can be achieved
The first way:
In SPRINGMVC projects, there are times when you need to use multiple view formats, such as Jsp,velocity and Freemarker, to map to different view files through different request path configuration rules. Below I provide a way of thinking, through the view template file suffix name to deal with. For example:
@RequestMapping (value = "/hello")Public String jsptest (httpservletrequest request, Modelmap map) {return "demo.jsp";}The JSP's vie
There are two ways to integrate struts2 with velocity
1, mainly to struts2. Struts2 built-in support for velocity, as long as the Issue: When accessing VM files directly, the source code of the VM is output. How to prohibit direct access to *.VM type files.
Benefit: You can use similar struts tags. I always feel that this is a strange use.
2, with velocity as t
Next http://blog.csdn.net/qust008/article/details/9623513
This configuration still needs to import the package, the new imported package is commons-beanutils-1.7.0, sitemesh-2.4.2, velocity-tools-View-2.0
Create a general template first. All VMS returned from the background are embedded in this template.
Under webcontent, create the folder decorators and create a file template. VM under decorators. The content is as follows:
Create the file decorato
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.