I have two files with @controller annotation
the first contains @RequestMapping("students") annotation and mapped methods like @RequestMapping("Add Student", method=RequestMethod.post)
the other开发者_高级运维 one @RequestMapping("teachers") annotation and mapped methods like @RequestMapping("Add Teacher", method=RequestMethod.post)
The mapped method "Add Teacher" returns "addTeacher" which is a .jsp file.
In addTeacher.jsp I have this link: Add Teacher but it doesn't work because it goes to localhost:8080/SchoolProject/students/Add Teacher/ I want to go to localhost:8080/SchoolProject/teachers/Add Teacher/
How can i rewrite the link from that .jsp file to go to teachers method ?
I'm not 100% sure I am fully understanding your issue. But you can probably use the spring tag library (specifically: http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/spring.tld.html#spring.tld.url)
Something like this should work:
<spring:url value="/teachers/Add Teacher/"/>
精彩评论