4, replace JSP with Velocity
(1) Add WebWorkVelocityServlet controller: WW2 / Web-INF / Web.xml
servlet>
servlet-maping>
l Add the webworkVELOCITYSERVLET controller to Web.xml and map to * .vm
(2) Configure web.i18n.encoding: WW2 / Web-INF / CLASS / WebWork.properties
Webwork.i18n.encoding = ISO-8859-1
l velocity uses webwork.i18n.encoding
l Webwork.i18n.Encoding is not set in the default configuration of WebWork2, so you need to set it in web.properties.
(3) Using Velocity Realization Results View: Hello.vm
$ action.gettext ('Greeting') $ NOW
p>
#foreach ($ Product In $ Products)
$ Product.description $ $ product.price i>
#end
body>
html>
l Use the resource bundle: use the $ Action.getText () method to get
l Get an action attribute value: Use $ PropertyName to get attribute values
The L #Foreach directive is also used to traverse the collection, and the difference is to use the variable receiving element object to further access its properties.
(4) Change Action Configuration: WW2 / WEB-INF / CLASS / XWork.xml
/ Web-inf / template / hello.vm param> result>
/ web-inf / jsp / hello.jsp param>
result>
->
l Modify the