Screenshot of the project structure as follows, the project is built by Maven Web project, the example is simple, no database connection operation, feature demo of the request address under the controller package of three classes, in this case the request address is:
Http://localhost:8080/spring-mvc-velocity-bootstrap/greet--Default Welcome
Http://localhost:8080/spring-mvc-velocity-bootstrap/greet/zhangsan-
Since the Apache Velocity template engine has been used as the output of the view layer in the project, in order to solve the XSS vulnerability, HTML escapes the content of the output to the page, which I typically implement in 2 ways:
Use filter Filters , where the httpservletrequestwrapper getparameter () method overloads are performed, HTML escapes at the bottom, and the page is output directly ;This approach is easy and straightforward,
Introduction to Velocity language2016-09-06 15:39:25Language introductionVelocity is a Java template engine technology and is a Java-based templating engine. She allows anyone to simply use the template language class to reference objects defined by Java code.When velocity is applied to web development, interface designers can synchronize with Java programmers to develop a Web site that adheres to the MVC
Define a template file of example. VM:
# This is an example velocity Template
# Set ($ this = "velocity ")
$ This is great!
# Foreach ($ name in $ List)$ Name is great!# End
# Set ($ condition = true)
# If ($ condition)The condition is true!# ElseThe condition is false!# End
Application that generates code:
Import org. Apache. Velocity. App.
VelocityVelocity Three species of referencevariable: A string representation of a Java object that returns the result of invoking the ToString () method of Java. method: Call a method of an object that must be public, the return value is ToString (), and the parameter of the method must also be string. properties: Except for accessing Java's class properties, it is equivalent to get. () method. Basic Symbols1, "#" to identify the velocity of the scrip
In my code, it is used as follows:Else if (recognizer. State = uigesturerecognizerstatechanged){Cgpoint velocity = [recognizer velocityinview: recognizer. View];Spriteact act = lastact;// Nslog (@ "velocity x = % F, y = % F", velocity. X, velocity. y );If (FABS (velocity. X)
News has not only been published so far, but I have also published news that can generate static pages before. However, I always feel that it is not very professional and inefficient.
Apache velocity has been found. It can be used in many fields. Currently, it is only used to display pages in struts to avoid overload of the same URL (such as shownews. do, maybe n people watch the news at the same time. The detailed content of this news shows that
Velocity is a Java-based template engine. developers can quickly develop the display layer using a simple template language, which separates the display layer from program code. In earlier versions of webwork, all UI labels are generated using the velocity template engine. You can find the template folder in the Struts-core-2.0.8.jar, where the archive folder stores the original VL file!
In struts2, find th
Java uses spring Javamailsenderimpl to send messages that support plain text, attachments, HTML, velocity templatesBlog Category:
Java
Spring
This article mainly introduces the use of Javamailsenderimpl to send mail. The general message is sent first, followed by the sending of rich Text (HTML) messages and the use of velocity as a template for sending messages. Message delivery is divided
Velocity is a Java-based template engine. It allows anyone to refer to objects defined by Java code simply by using template language (language)
Velocity's syntax is very simple. Not much to introduce here.Our usual Web project, the usual development process is to write a static page at the front end. The backend changes the static page to a JSP and receives the data passed by the action module in the appropriate place where the data needs to be
Velocity is a Java-based template engine. It allows anyone to refer to objects defined by Java code simply by using template language (language).
When velocity is applied to web development, interface designers can synchronize with Java program developers to develop a Web site that adheres to the MVC architecture, which means that page designers can focus only on the display of the page, while the Java prog
Tags: HTTP Io ar OS Java for SP File
Compared with freemarker, velocity is more simple and lightweight, but its functions are not as powerful as freemarker.For most applications, freemarker is easier to use than velocity, because velocity must also write custom toolbox classes and write some common template code repeatedly, therefore, more valuable time is lost
First, two necessary jar packages are required:
Velocity. Jar velocity-tool-view.jar
Web. xml
velocity.properties
input.encoding=utf-8output.encoding=utf-8WebRoot.resource.loader.class = org.apache.velocity.tools.view.servlet.WebappLoaderwebapp.resource.loader.path=/WEB-INF/vm/
Background call:
String realpath = request. getrealpath ("/"); // template path string urlvm = "/WEB-INF/Vm/test. VM "; // The
I. background and descriptionVelocity is a java-based template engine that allows anyone to reference objects defined by java code simply using the template language. We know that the more powerful the rendering layer language with rich functions (in a sense, PHP can also be classified as a rendering layer Language), the more security problems it brings.Some people think that velocity cannot write java code like jsp, And it is strictly isolated by mvc
Velocity and Freemaker, jstl are called Java Web Development Three big label technology, and Velocity on the CodePlex also has. NET ported version nvelocity, (note: The Castle team also maintains a version on GitHub For teams that use heterogeneous technologies. NET and Java), always want to find a common technology, compatible with all technology platforms, in order to reduce the cost of learning, it is no
Webwork/JSP/velocity login page
Author: Erik Swenson, Chen Xiaoyu (Translated by: 20:32:48)
Overview Webwork is an openSource codeWeb application framework. The purpose is to simplify web application development. This topic introduces webwork and explains the process of creating a login webpage using webwork and two different view technologies: assumerverpages (JSP) and v
Velocity is a Java-based template engine in Apache. the simple use of this Apache velocity template engine can better separate style design from Java development.
For example, when sending emails to some customers, the mail body usually contains some standardized forms or links. When sending emails, of course, we can add HTML Tag modifier when writing the body in Java code to achieve the following goals:
Having used to use velocity, I encountered a problem in Porting previous Turbine-based programs to liferay4.0rc, which had plagued me for many days. Today, I finally completely solved the problem, which is summarized as follows: 1. liferay uses COM. liferay. util. velocity. multipleresourceloader to load VM files. The setting of this loader is in COM. liferay. portal. events. initaction. The system calls th
Spring MVC integrated Velocity template
Spring MVC
We used struts2 when using the traditional configuration file in a way that did not use the legendary 0 configuration. SPRING3 MVC can be thought of as having 100% 0 configured (in addition to configuring spring Mvc-servlet.xml).
The difference between Spring MVC and STRUTS2:1. Mechanism: Spring MVC's entry is the servlet, and Struts2 is the filter (it is noted here that the filter and servlet are di
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.