Resolution of the $conflict between jquery in HTML files and the velocity variable

  • 2020-03-26 21:45:40
  • OfStack

Problem description:

In the use of the velocity template engine environment, when using jquery, such as: $. FullCalendar. GcalFeed (' http://www.google.com/calendar/feeds/sfzc1%40realintelligence.com/public/basic ')

Where $conflicts with $in the velocity variable.

Solutions:

Define a velocity variable: #set($jquery="$.") and then: ${jquery} fullCalendar. GcalFeed (' http://www.google.com/calendar/feeds/sfzc1%40realintelligence.com/public/basic '), using the template engine veloctiry substitution principle, HTML code first compiled into $. FullCalendar. GcalFeed (' http://www.google.com/calendar/feeds/sfzc1%40realintelligence.com/public/basic '), be replaced after the second compilation, code without any problems.

To sum up, there is a truth: "the person who ties the bell must tie the bell."

Related articles: