28 lines
768 B
Java
28 lines
768 B
Java
package com.baeldung.thymeleaf.controller;
|
|
|
|
import java.text.DateFormat;
|
|
import java.util.Date;
|
|
import java.util.Locale;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
/**
|
|
* Handles requests for the application home page.
|
|
*
|
|
*/
|
|
@Controller
|
|
public class HomeController {
|
|
|
|
@RequestMapping(value = "/", method = RequestMethod.GET)
|
|
public String getHome(Model model) {
|
|
|
|
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.getDefault());
|
|
model.addAttribute("serverTime", dateFormat.format(new Date()));
|
|
return "home";
|
|
}
|
|
|
|
}
|