mvc.TestController.java Source code

Java tutorial

Introduction

Here is the source code for mvc.TestController.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mvc;

import java.util.Calendar;
import java.util.Map;
import mvc.parent.WebController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 *
 * @author ??
 */
@Controller
@RequestMapping("/Test")
public class TestController extends WebController {

    @ModelAttribute
    public void setInfo(Map<String, Object> model) {
        setInfoForCommonPage(model);
    }

    @RequestMapping("/testTimeZone")
    public String testTimeZone(Map<String, Object> model) {
        Calendar cl = Calendar.getInstance();
        model.put("timezone", cl.getTimeZone());
        model.put("date", cl.getTime());
        return "Test_timezone";
    }

}