在jhipster我无法使用哈希#'#'在网址,但问号'?'工作正常。
例如:
www.basicurl.com/firstname.lastname#/demo/test
删除" firstname.lastname"来自url,成为www.basicurl.com#/ demo / test。但是,当我使用问号时,它变为:
basicurl.com/firstname.lastname?/demo/test
这很好用。
我的firstname和lastname的配置文件页面映射代码如下:
@RestController
public class ProfileMappingResource {
@RequestMapping(value = "/{firstName}.{lastName}", method = RequestMethod.GET, produces = "application/json")
@Timed
public void loadProfilePageMapping(@PathVariable String firstName,@PathVariable String lastName,HttpServletRequest request,HttpServletResponse response) {
String newURI = "/dist" + "/profile.html";
try {
RequestDispatcher requestDispatcher = request.getRequestDispatcher(newURI);
requestDispatcher.forward(request, response);
} catch (Exception e) {
e.printStackTrace();
}
return;
}
}
答案 0 :(得分:0)
那是因为?将URL的其余部分拆分为参数字符串(通常是?param1 = value1& param2 = value2等),因此不会将其用作路径变量。