1. ToStruts2 mainly.Struts2 built-in support for velocity, as long as the <result name= "success"? type= "Velocity" >success.vm</result> You can automatically parse the velocity template file.
Issue: When accessing VM files directly, the source code of the VM is output. How do I prohibit direct access to *.VM type files?
Benefits: You can use similarStruts tab. I always feel that this is a strange use.
2, with velocity as the main. Configuring the Velocity servlet and *.VM mappings in Web. xml
Benefit: Very convenient to use velocity tools2.0 (need to add several Jar class libraries)
Because you do not want to use the struts label, regardless of 1 and 2, the client cannot generate the same JavaScript code as the server-side validation , Validatortool only applies to struts1.1, which has not been updated for two years.
Solution: Use jquery or MooTools form to validate the collection and write part of the code. When it comes to Ajax, it also requires handwriting, and integration is too complex to save
According to the above, the individual thinks that the best of the scheme 2, direct *.VM map out, simple and convenient. There is no need to use the struts Tag Library.
Just thought of the question: Can the VM automatically generate HTML files to use Apache Direct output, secondary access no longer need to go through the program?
VMs are efficient, cached template technology that has a higher output performance than a jsp. The purpose of static is to use Web servers such as Apache to mitigate the stress of application servers such as Tomcat
Static is not very useful, if the traffic is large, increase the throughput of the hardware service area and use Squid server-side cache (this is also static), or to solve the problem from the architecture
There are two ways to integrate struts2 with velocity