test tile

package com.journaldev.spring.controller;

import java.text.DateFormat;
import java.util.Date;
import java.util.Locale; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; @Controller
public class HomeController { private static final Logger logger = LoggerFactory.getLogger(HomeController.class); @RequestMapping(value = "/home", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate ); return "home";
} @RequestMapping(value = "/emp/get/{id}", method = RequestMethod.GET)
public String getEmployee(Locale locale, Model model,@PathVariable("id") int id) {
logger.info("Welcome user! Requested Emp ID is: "+id);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale); String formattedDate = dateFormat.format(date); model.addAttribute("serverTime", formattedDate );
model.addAttribute("id", id);
model.addAttribute("name", "Pankaj"); return "employee";
} @RequestMapping(value="/login")
public String login(HttpServletRequest request, Model model){
return "login";
} @RequestMapping(value="/logout")
public String logout(){
return "logout";
} @RequestMapping(value="/denied")
public String denied(){
return "denied";
}
}

test spring in category的更多相关文章

  1. Spring学习笔记2——创建Product对象,并在其中注入一个Category对象

    第一步:创建Product类.在Product类中有对Category对象的set和get方法 package com.spring.cate; public class Product { priv ...

  2. Spring学习笔记4——AOP

    AOP 即 Aspect Oriented Program 面向切面编程 首先,在面向切面编程的思想里面,把功能分为核心业务功能,和周边功能. 所谓的核心业务,比如登陆,增加数据,删除数据都叫核心业务 ...

  3. Spring学习笔记3——使用注解的方式完成注入对象中的效果

    第一步:修改applicationContext.xml 添加<context:annotation-config/>表示告诉Spring要用注解的方式进行配置 <?xml vers ...

  4. Spring学习笔记1——入门

    Spring是一个基于IOC和AOP的结构J2EE系统的框架 IOC 反转控制 是Spring的基础,Inversion Of Control 简单说就是创建对象由以前的程序员自己new 构造方法来调 ...

  5. 面试之Spring

    一.IoC IoC(Inversion of Control):控制反转(是把传统上由程序代码直接操控的对象的生成交给了容器来实现, 通过容器来实现对象组件的装配和管理.所谓"控制反转&qu ...

  6. spring框架学习(一)——IOC/DI

    什么是Spring框架: Spring是一个基于IOC和AOP的结构J2EE系统的框架: IOC 反转控制 是Spring的基础,Inversion Of Control,简单说就是创建对象由以前的程 ...

  7. spring框架学习(二)——注解方式IOC/DI

    什么是注解 传统的Spring做法是使用.xml文件来对bean进行注入或者是配置aop.事物,这么做有两个缺点: 1.如果所有的内容都配置在.xml文件中,那么.xml文件将会十分庞大:如果按需求分 ...

  8. SpringIOC/DI(2)

    2019-03-08/09:24:37 开发环境:IDEA 1.创建Spring项目 File--New--project--Spring--Creat empty Spring-config.xml ...

  9. Spring+Mybatis基于注解整合Redis

    基于这段时间折腾redis遇到了各种问题,想着整理一下.本文主要介绍基于Spring+Mybatis以注解的形式整合Redis.废话少说,进入正题. 首先准备Redis,我下的是Windows版,下载 ...

随机推荐

  1. XAMPP 的安装配置(Linux 版)

    --姜庭华  msn: jaimejth@live.cn --博客:http://blog.csdn.net/jaimejth 软件下载在以下网站 http://www.apachefriends.o ...

  2. Android activity和service的生命周期对比

    1Activity生命周期 七个方法 1. void onCreate(Bundle savedInstanceState) 当Activity被第首次加载时执行.我们新启动一个程序的时候其主窗体的o ...

  3. 解决1130 Host 'localhost' is not allowed to connect to this MySQL server

  4. PEP 8

    官方文档: PEP 8 :Style Guide for Python Code 部分翻译: http://www.blogjava.net/lincode/archive/2011/02/02/34 ...

  5. C#的类及应用

    1.int i=x.Length;//Length(获取字符串的长度,返回一个int类型的值) 2.x=x.Trim();(去掉字符串前后的空格) trimStart();(去掉前面的空格) Trim ...

  6. android和linux开发环境建立(驱动层)

    流程:安装ubutu14.04操作系统==>安装各种库和应用程序并配置环境变量 1,install ubuntu14.04 为了完全释放PC机的资源,我们安装在主机上,就不用虚拟机来玩了.下面是 ...

  7. PHP 类中的魔术方法

    定义: PHP类中以两个下画线“__”开头的方法被称为魔术方法. 分类: 例如:构造方法:__construct:析构方法:__destruct:动态重载:__set().__get().__call ...

  8. codeMirror的简单使用,js比较文本差异(标注出增删改)

    最近项目需要使用比较文本的差异的功能,在同事的推荐下,使用js脚本来比较,所以codeMirror变成了选择. 当然codeMirror中有其他功能,比较文本差异的只是其中一个功能,本人不在此做介绍, ...

  9. [Thinking in Java]这些必须先了解

    2.基本概念和认识 2.1 Java引用 Java中一切皆是对象,一切对象实例的标识符号(对象名称)都只是对象的引用. 2.2 对象的创建 通过new关键字创建,但是要注意基础类型和String类型的 ...

  10. Python-SocketServer源码

    贴到博客,地铁上看- """Generic socket server classes. This module tries to capture the various ...