Similar to freemarker. Nice stuff.
1 ConfigurationPut the toolbox. xml of velocity under Web-INF, And put velocity. properties under Web-INF.
2 integration with springOrg. Apache. Velocity. Tools. View. servlet. velocityviewservlet
3. Common usage# If ($ userinfo. haspermission (1 ))
....
# End
# Foreach ($ FJ in $ fjlist)# End
# Set ($ I = 1)
Common methods:$myarray. IsEmpty () array is empty$myarray. Size () Gets the number of array elements$myarray. Get (2) gets an array of elements that specify subscript$myarray. Add () add elementArrays AccessVelocity accesses an Array object and cannot access elements of a particular location through similar arr[2].#set ($arr = [0, 1, 2, 3])$arr. Get (2)Note: The array in Velocity corresponds to the list object in Java. For Java native Array objects,
In the past few years, distributed memory cache applications have become quite popular, from mainstream Java applications to edge languages like Erlang. To continue to catch up with the dominant technology in the Open Source world, Microsoft also introduced its distributed cache.Velocity is a distributed cache designed specifically for the. NET platform. Those who are familiar with other distributed memory caches will find many similar features. It is currently available for external download as
I. Basic Syntax 1. "#" is the script statement used to identify velocity, including # Set, # If, # else, # End, # foreach, # End, # iinclude, # parse, # macro, etc.; for example: # If ($ info. IMGs) # else # end2," $ "is used to identify an object (or be understood as a variable); for example: $ I, $ MSG, $ tagutil. options (...). 3. "{}" is used to clearly identify the velocity variable. For example, if $
Velocity中加载vm文件的三种方式velocitypropertiespathVelocity中加载vm文件的三种方式:方式一:加载classpath目录下的vm文件Properties p = new Properties();p.put("file.resource.loader.class","org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");Velocity.init(p);...Velocity.getTemplate(templateFile);方式二:根据绝对路径加载,vm文件置于硬盘某分区中,如:d://tree.vmProperties p = new Properties();p.setProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH, "d://");Velocity.init(p);...Velocity.getTemplate(
1. Add in Pom.xml Dependent1 Dependency>2 groupId>Org.apache.velocitygroupId>3 Artifactid>VelocityArtifactid>4 version>1.7version>5 Dependency>6 Dependency>7 groupId>Org.apache.velocitygroupId>8 Artifactid>Velocity-toolsArtifactid>9 version>2.0version>Ten Dependency>2. Copy the velocity.properties and Tools.xml files from the
Velocity 8th application examples ---- # if # else # end sample code. For more information, see
Velocity 8th application examples ---- # if # else # end
// 2 Create a Context objectVelocityContext context = newVelocityContext (); // 3 Add you data object to this contextcontext. put ("condition", false); // 4 Choose a templateTemplate template = Velocity. getT
Take a look at the following code:
# Foreach ($ ID in [1 .. 50])
# Set ($User = $ user. Get ($ id ))
$ ID: $ {user. name}
# End
In the above Code, assume that only one user with the ID of 1 exists, but it will show that 50 IDs are the users with the ID of 1 and their names, because in velocity, if the result returned by a value assignment statement is null, the value of the assigned object is not changed, that is, the $ user
achieve strict MVC separation2, the performance is very good3. Good support for JSP tags4, built in a lot of common functions, easy to use5, macro definition (like JSP tags) very convenient6. Using an expression languageDisadvantages:1. Not the official standard2, user groups and third-party tag libraries do not have more JSPReasons to choose Freemarker:1, performance. Velocity should be the best, followed by the JSP, and the average page Freemarker
1. Load the velocity expansion package to the project first via Pom.xml:1 Dependency>2 groupId>VelocitygroupId>3 Artifactid>VelocityArtifactid>4 version>1.5version>5 Dependency>2. Then add the following configuration in the XML that automatically loads the bean:1 BeanID= "Velocityconfig"2 class= "Org.springframework.web.servlet.view.velocity.VelocityConfigurer">3 Propertyname= "Resourceloaderpath"value= "/web-inf/views/" />4 Prop
In Java EE application Development, the velocity template files are often packaged together in a jar file, but velocity's default behavior is to read the template file from the OS file system and use Fileresourceloader to read the template file.If you want to get the template file from Classpath instead, adjust the velocity initialization parameters:Velocityengine ve=new velocityengine ();Optional value: "C
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,
[Smart Home] applications of wifi in Smart Home and wifi in Smart Home
Reprint please indicate the source: http://blog.csdn.net/Righthek thank you!
When designing a smart home system solution, a critical point is the networking mode. The networking mode is related to the stability, scalability, and real-time performance of the entire Smart Home System. In terms of installation and maintenance, I think no on
Flash is China's Zhejiang Telecom for college users to launch the dial-up Internet software, after the successful dial-up, users can be converted to wireless WiFi through the WiFi shared companion software, easy to use mobile devices, WiFi companion software users can freely set WiFi hotspot name and password, you can
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 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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service