[英]I need to refer to an image that can be pointed regardless of the URL of the Controller in Spring MVC
[英]how can I refer to another mapped controller in spring mvc?
我有两个带有@controller批注的文件
第一个包含@RequestMapping(“ students”)批注和映射的方法,例如@RequestMapping(“ Add Student”,method = RequestMethod.post)
另一个@RequestMapping(“ teachers”)批注和映射的方法,例如@RequestMapping(“ Add Teacher”,method = RequestMethod.post)
映射的方法“添加教师”返回.jsp文件“ addTeacher”。
在addTeacher.jsp中,我具有以下链接:添加教师,但由于它转到localhost:8080 / SchoolProject / students / Add Teacher /而无法正常工作,我想转到localhost:8080 / SchoolProject / teachers /添加老师/
我该如何重写该.jsp文件中的链接以转到教师方法?
我不确定100%是否完全了解您的问题。 但是您可能可以使用spring标记库(特别是: http : //static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/spring.tld.html#spring.tld。网址 )
这样的事情应该起作用:
<spring:url value="/teachers/Add Teacher/"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.