Solr (6) _ How to reference the velocity template engine in a web project

Source: Internet
Author: User

I didn't plan to learn about the velocity template engine. I simply learned how to use velocity in solr browse.

Download the velocity-tools-2.0.zip file from http://velocity.apache.org/download.cgiand then decompress it. The decompressed velocity-tools-2.0 \ examples directory contains three war files. Select simple. war and put it in the webapps directory of tomcat, and then start tomcat.

Enter http: // localhost: 8983/simple/in the browser to see the effect of index. vm.

What should we do if we develop it on our own?

Create a web project according to the structure in the simple directory in webapps. Showcase. war contains many velocity tools and usage methods.

If you directly copy the web. xml in the simple project, an error may be reported: Can not find the tag library descriptor for "http://velocity.apache.org/velocity-view"

In web. xml

 
 
  1. <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> 
  2.  
  3. <web-app> 

Change

 
 
  1. <web-app version="2.5"  
  2.     xmlns="http://java.sun.com/xml/ns/javaee"  
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4.     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
  5.     http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 

No error will be reported.

This article from the "every day progress a little" blog, please be sure to keep this source http://sbp810050504.blog.51cto.com/2799422/1183931

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.