【问题标题】:HTTP Status 404 Spring rest The requested resource is not availableHTTP 状态 404 Spring rest 请求的资源不可用
【发布时间】:2014-05-25 14:15:06
【问题描述】:

我正在使用 spring 3.2.2.RELEASE 并且在向服务器发送请求时遇到问题:

http://asdsda:8080/spr-mvc-hib/user/userHizmet.html?userId=19 

HTTP 状态 404 请求的资源不可用。

@RequestMapping(value = "/userHizmet/{userId}", method = RequestMethod.GET)
public ModelAndView userHizmet(@PathVariable String userId)
{
    ModelAndView mav = new ModelAndView("userte");

我打电话的地方:

success: function (data) {
                        alert(data);
                        window.location.href="${pageContext. request. contextPath}/user/userHizmet.html?userId="+data;
                    },

调度员:

Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));
    servlet.addMapping("/");

【问题讨论】:

  • 请查看网址。您的网址似乎有误。
  • localhost:8080/spr-mvc-hib/user/userHizmet.html?userId=19 问题出在哪里?通常我在没有参数的地方使用?,我认为我的调度程序或路径变量不正确,不是吗?
  • 使用 servlet (userHizmet.html) 更新您的 URL。
  • 更新是什么意思?我应该用什么? @Controller @RequestMapping(value="/user") 公共类 UserControllers

标签: spring rest http-status-code-404 path-variables


【解决方案1】:
localhost:8080/spr-mvc-hib/user/userHizmet.html?userId=19

删除.html 并使用requestparam 解决了我的问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-23
    • 2012-01-21
    • 2017-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-26
    相关资源
    最近更新 更多