simplifies the work of all the people involved in the software development process, so that changes to the different parts of the system usually do not affect the rest of the work. For example, modify the background of some programs do not affect the foreground of the page display, the front page changes do not affect the background program development.This division of division is much better than the way JSP confuses code logic and display layers. Therefore, more and more foreign programmers a
Spring MVC version 4.1.6.RELAESE is used in recent projects And Velocity-tools was upgraded to 2.0 by my 2B. ------------------------------ Where the MVC 3 version requires custom Viewclass to complete the velocity tools loading, or error This step, online already someone share out method: ID= "Velocityviewresolver"class= "Org.springframework.web.servlet.view.velocity.VelocityViewResolver"> name= "Viewc
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
Maybe a lot of children's shoes are still not very clear. In MyBatis you can use a variety of scripting languages to define dynamic SQL in a mapper file; Currently, MyBatis supports scripting languages with XML (default), Velocity and freemarker three. Use a different scripting language to complete the mapper file, the first is to use their familiar scripting language, the second is to be able to define more rich custom instructions to simplify the de
First, preface
The common Java template engine has JSP, freemark,velocity. In the MVC three layer framework, the template engine belongs to the view layer, in essence, the model layer content is presented to the foreground page of an engine, velocity with its front and rear decoupling so that the front and back can be developed at the same time and the simplicity of its syntax has been widely used, the gro
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.
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
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.