freemarker取值问题

package com.hd.controller;

import java.util.Date;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/")
public class QuZhiController {
    @RequestMapping("/quzhi")
    public ModelAndView getValue(){
        ModelAndView mv=new ModelAndView("quzhi");
        mv.addObject("intVar", 100);
        mv.addObject("longVar", 1000L);
        mv.addObject("doubleVar", 3.14d);
        mv.addObject("booleanVar", false);
        mv.addObject("dateVar",new Date());
        return mv;
    }
}





取值


整数${intVar}

整数${longVar}
双精度数${doubleVar}
布尔值${booleanVar?string('yes','no')}
日期${dateVar?string('yyyy-MM-dd HH:mm:ss')}

你可能感兴趣的:(freemarker取值问题)