I have a Spring MVC (3) controller, and I'm trying to put annotations, but failed. Heres my code out
@Controller
public class SpringController {
@RequestMapping("/welcome")
public String myHandler(@RequestParam("id") String id) {
HttpSession session = request.getSession();
session.setAttribute("name","Mike") ;
return "myFirstJsp";
}
@RequestMapping("/process")
public String processHandler(@RequestParam("processId") String processId) {
String someName = session.getAttribute("name");
return "result";
}
}
Just for the sake of the session object, I have to declare HttpServletRequest and HttpSession. In any case, we may have a solution with @nnotations.
Thank!
source
share