1. 程式人生 > >springmvc-查找方法學習筆記

springmvc-查找方法學習筆記

springmvc 查找 方法 學習筆記

import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping(value="/emp") public class EmpAction { @RequestMapping(value="/find") public String findEmpById(int id,Model model) throws Exception{ System.out.println("查詢"+id+"號員工信息"); //轉發到EmpAction的另一個方法中去,即再次發送請求 return "forward:/emp/update.action"; //重定向到EmpAction的另一個方法中去,即再次發送請求 //return "redirect:/emp/update.action?id=" + id; } @RequestMapping(value="/update") public String updateEmpById(int id,Model model) throws Exception{ System.out.println("更新" + id +"號員工信息"); model.addAttribute("message","更新員工信息成功"); return "/jsp/ok.jsp"; } }

springmvc-查找方法學習筆記