The third application example of velocity-sample code for traversing a set array can be found below
The third application example of velocity -- traversing a set/array
// 2. create a Context objectVelocityContext context = newVelocityContext (); // 3.Add your data objects to this contextcontext. put ("list", Arrays. asList ("first", "second", "third", "fourth"); // 4. choose a templateTemplate template
One. Traverse a map type1. Read the background Java program firstJava codeMapString,string>Paramvalues=New HashMapstring, string>();**** * * the intermediate assignment operation omitted***Data.put ("paramvalues", paramvalues); pass the value to velocity 2. Remove the key and value of this map from the foreground velocity template fileJava code#foreach ($param in ${paramvalues.keyset ()})Tr
Understanding of the continuum hypothesis in macroscopic mechanics:Macroscopic mechanics (such as fluid mechanics, elasto-plastic mechanics, etc.) are the objects of a large number of molecules, at this time each set constitutes a small micro-body, the whole object is made up of the countless small micro-bodies continuously without gaps in the composition. Because we only need to pay attention to the nature of the objects on each set, such as density, veloci
This morning, when I saw livesino's RSS feed, I found this message hidden in "teched 2008 developers: News Summary". Microsoft finally launched their distributed cache (
Distributed in-memory cache) .
Currently, the cache in Asp.net is on the local machine. If each machine in the Web farm needs to maintain its own cache, the most common cacheitem has a copy on each server. this not only wastes memory, but may also cause non-synchronization issues. The distributed cache solves this problem. in a
Objects in 3D space move at a certain speed and sometimes require the object to be oriented in the same direction as the velocity,In order to achieve this goal we generally use the rotation matrix M to rotate the object to the corresponding orientation.For example, the velocity direction vector Spdv:vector3d (The x-axis base vector is Axis_x:vector3d (1,0,0), and the direction of the vector is aligned with
Next to the previous response
When spring MVC integrates velocity, it is necessary to introduce related packages. The packages to be imported are as follows:
Then, it is very simple configuration, then here, modify the content of the springMvc-servlet.xml, the content is modified as follows
Then create the velocity. properties file in the WEB-INF folder, the content is very simple, just a few words
Input
I. Traversing a map type
1. First look at the background Java programJava code
Copy Code code as follows:
Map***
The middle assignment operation omitted the
***
Data.put ("Paramvalues", paramvalues);//pass value to velocity
2. Take out the key and value of this map in the velocity template file of the foregroundJava code
Copy Code code as follows:
#foreach ($par
Org.apache.velocity.tools.generic.DateTool
Jfinal can add Request.setattribute ("date", new Datetool ()) to the interceptor, which you can use at any time in the velocity template of the. vm.
About date, as follows:
function examples Show results
function Examples
Show Results
$date
2008-04-22
$date. Long
April 22, 2008 10:58 P.M. 54 seconds
$date. Medium_time
22:58:54
$da
1.Velocity is a Java-based template engine. You can reference a Java object.is the ability to adjust and populate page layouts and page content based on business logic, using Java objects. I personally think that the template is to provide a shell, in what position to put what kind of data, how to put the data in order to achieve what kind of display effect.So, the template is very similar, you just need to understand its rules of use. 2. Basic syntax
There was a freemarker in front of me. I did not cherish, met the velocity I just remembered the lost beautiful ...Demand is the PC page click, Mobile Web click, app click Add to get total clicks show out:$article. hits+ $article. waphits+ $article. mobilehitsIdeal is very good, the reality of output is: Number+number+number a large string (like that year. When you use the Freemarker. Add and subtract operations directly on, and now ... )It is said th
The first company was developed using ASP, and I worked on the front end. At that time using velocity to write the template program remember also not configured what, I remember to write the rewrite,html page directly written in the velocity.Now the company uses Java to develop. Directly in the HTML document to write #parse does not take effect, asked the backstage staff to use velocity words to turn the pa
Velocity is a Java-based template engine.This blog post demonstrates the Helloword and branching conditions of Velocity.HELLOWORD.VM, template file.Templatedemo.java, demonstrating the Velocity template engine.App.java, application of the entranceOn Eclipse, based on MAVEN management tools, the post-run directory structure is as followsThe source code exists only under the./src/main directory. The target di
This is about some of the usage of velocity, the use of more basic.Velocity Generation JavaBeanFirst, define a simple bean class Public classClassbean {PrivateString name; PrivateString Comment; PublicString GetName () {returnname; } Public voidsetName (String name) { This. Name =name; } PublicString getcomment () {returncomment; } Public voidsetcomment (String comment) { This. Comment =comment; }}Ii.
Velocity is a Java-based template engine (template engine). It allows anyone to simply use the template language (template language) to refer to objects defined by Java code.
Now let's take a look at this little example:
1. Create a velocity template to end with the VM, the template file in the example is TAXREPORTXML.VM, which reads as follows:
$name the parameters that you want the program to pass in.
ObjectiveFor the velocity and SPRINGMVC configuration please refer to the previous article, which is not covered here. The main purpose of velocity as a Java template engine is to allow anyone to reference objects defined in Java code using a simple and powerful template language. You can specify a template layout for this page in the velocity file, saving a lot
Spring MVC consolidates the velocity to introduce the packages that need to be imported, such asPom Introduction:Then, is a very simple configuration, then, here, modify the next spring-mvc.xml content, the content is modified as followsXML version= "1.0" encoding= "UTF-8"?>See below the beans this element tag does not have to have the label declaration -Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSch
Detailed description of the velocity template makes Java Web html + js modular, and velocityjavaweb
Detailed description of the velocity template makes Java Web html + js Modular
Some basic data on the page or some frequently used parts on other pages can be made into small components independently. The component reserves the call entry, and the required page can be called directly., The Display category an
sending mail in spring is an easy task, and it's much easier to send it using velocity as a template for mail. First of all, or simply describe the configuration in sping, send mail needs a mail engin:class= "Com.aodragon.jdt.backend.service.impl.MailEngineImpl" > The following classes are implemented: PackageCom.aodragon.jdt.backend.service.impl;ImportJava.util.Map;Importjavax.mail.MessagingException;ImportJavax.mail.internet.MimeMessage;Importorg.ap
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.