Jsp JSTLURL标记生成错误的url
我正在尝试使用以下url向我的Spring MVC控制器映射发送请求:Jsp JSTLURL标记生成错误的url,jsp,spring-mvc,jstl,Jsp,Spring Mvc,Jstl,我正在尝试使用以下url向我的Spring MVC控制器映射发送请求: @RequestMapping(value = "/place/{placeId}/menu/service", method = RequestMethod.POST) public String registerNewPlaceMenuService(@Valid ServiceDTO serviceDTO, @PathVariable
@RequestMapping(value = "/place/{placeId}/menu/service", method = RequestMethod.POST)
public String registerNewPlaceMenuService(@Valid ServiceDTO serviceDTO,
@PathVariable("placeId") long placeId,
BindingResult result) {
if(!result.hasErrors()) {
PlaceUser user = userService.placeUser();
Place place = placeService.getOwnerPlace(placeId, user);
if (place != null) {
PlaceMenu menu = dao.getMenuById(serviceDTO.getMenuId());
if (place.getPlaceMenu().contains(menu)) {
placeService.registerNewPlaceMenuService(menu, serviceDTO);
}
}
}
return "redirect:place/" + placeId;
}
这是我如何使用jstl url标记的:
<c:url context="/" value='/place/${place.id}/menu/service'
var="newservice"/>
<sf:form modelAttribute="service" action="${newservice}" method="post">
我甚至不明白最后一个“/服务”部分到哪里去了!
我从中发送请求的页面具有以下url
http://localhost:8080/place/30
救命啊 试试这个:
@RequestMapping(value = "/place/{placeId}/menu/service", method =
RequestMethod.POST)
试试这个:
@RequestMapping(value = "/place/{placeId}/menu/service", method =
RequestMethod.POST)
thanx,这是一个正确的方向,我有一些带有beckend代码的trobles,而不是表单url。我认为您在方法中返回的值有错误。尝试添加“菜单”和“服务”路径,以便进行连接,并在@RequestMapping值中创建相同的url。thanx,这是一个正确的方向,我有一些错误,我的beckend代码不是表单url。我认为您在方法中返回的有错误。尝试添加“菜单”和“服务”路径,以便进行连接,并在@RequestMapping值中创建上面相同的url。