Myths about velocity plus subtraction and other arithmetic

Source: Internet
Author: User

There was a freemarker in front of me. I did not cherish, met the velocity I just remembered the lost beautiful ...


Demand is the PC page click, Mobile Web click, app click Add to get total clicks show out:

$article. hits+ $article. waphits+ $article. mobilehits
Ideal is very good, the reality of output is: Number+number+number a large string (like that year. When you use the Freemarker. Add and subtract operations directly on, and now ... )



It is said that you need to add a space on both sides of the arithmetic. All right. Try the following:

$article. Hits + $article. Waphits + $article. mobilehits
The velocity is not recognized. Give me the same output large string. I think of the lost Freemarker, the ear sounded "lost beautiful"



Well, then use the ultimate skill (put the operation in the velocity script):

#set ($total = $article. Hits + $article. Waphits + $article. mobilehits)                $total

Yes, I can, Commit ...



Myths about velocity plus subtraction and other arithmetic

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.