Java tutorial
/* * 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 com.tsg.techsupportmvc; import com.tsg.techsupportmvc.dao.UserDao; import java.util.Enumeration; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** * * @author apprentice */ @Controller public class HomeController { @RequestMapping(value = { "/", "/home" }, method = RequestMethod.GET) public String displayHomePage(Model model, HttpSession session) { session.setAttribute("startTime", System.currentTimeMillis()); session.setAttribute("page", "messageBoard"); session.setAttribute("js_page", "messageBoard.js"); return "home"; } @RequestMapping(value = { "/knowledgeBase" }, method = RequestMethod.GET) public String displayKnowledgeBase(Model model, HttpSession session) { session.setAttribute("startTime", System.currentTimeMillis()); session.setAttribute("page", "knowledgeBase"); session.setAttribute("js_page", "knowledgeBase.js"); return "home"; } @RequestMapping(value = { "/links" }, method = RequestMethod.GET) public String displayLinks(Model model, HttpSession session) { session.setAttribute("startTime", System.currentTimeMillis()); session.setAttribute("page", "links"); return "home"; } @RequestMapping(value = { "/tax" }, method = RequestMethod.GET) public String displayTaxRates(Model model, HttpSession session) { session.setAttribute("startTime", System.currentTimeMillis()); session.setAttribute("page", "tax"); return "home"; } }