从jsp重定向jsp-pg电子游戏官网

热度:9℃ 发布时间:2023-02-26 23:05:12
(adsbygoogle = window.adsbygoogle || []).push({});

如何解决从jsp重定向jsp-错误“请求的资源不可用”?

如果响应是相对于servlet上下文的,则在url之前添加上下文路径。

string contextpath = request.getcontextpath();response.sendredirect(response.encoderedirect;

解决方法

我在一个社交网站上工作,但遇到以下问题。在profile.jsp我的表格中,用户可以上传照片。此表单对fileuploadhandlerservlet
有一个操作,该操作会上传照片,然后将重定向发送至,uploadfilecontroller.jsp如下所示:

requestdispatcher requestdispatcher;requestdispatcher = request.getrequestdispatcher("/uploadfilecontroller.jsp");requestdispatcher.forward(request,response);

在中,uploadfilecontroller.jsp我将此帖子插入到mysql中,并将重定向发送到profile.jsp。

response.sendredirect("/profile.jsp");

但是然后我收到此错误消息:

http状态404-/profile.jsp

类型状态报告

消息/profile.jsp

描述所请求的资源不可用。

但是,当我再次转到profile.jsp该帖子时就创建了!有任何想法吗?

网友评论
评论
更多常见问答
  • 常见问答推荐
更多
最新软件下载
网站地图