Send redirect to relative path in JSP?

强颜欢笑 提交于 2019-11-27 14:49:14

Most reliable would be to create a domain-relative URL with the context path included.

response.sendRedirect(request.getContextPath() + "/seja/izpisknjig.jsp");

You can use JSP taglib to do redirection.

Content of index.jsp file :

<jsp:forward page="../seja/izpisknjig.jsp" />

If project and seja are at root of your webapp context ( ie. http://host:port/context/project )

Content of index.jsp file :

<jsp:forward page="/seja/izpisknjig.jsp" />

You may be overthinking this. You could just pier some generate some javascript to redirect anywhere you like.

  document.location = "MyPage.php?action=DoThis";
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!