简体   繁体   English

重定向URL JSP

[英]Redirect url JSP

I am trying to access a jsp file from WEB-INF/JSP/A.jsp. 我正在尝试从WEB-INF / JSP / A.jsp访问一个jsp文件。 But finding it bit complex to understand to it. 但是发现要理解它有点复杂。

Can some one explain some thing on redirect url path? 有人可以解释重定向网址路径上的某些内容吗? What should be the redirect path. 什么是重定向路径。 Can I have a custom path like WEB-INF/MyHtml/AB.html 我可以使用WEB-INF / MyHtml / AB.html这样的自定义路径吗

The below code is in Home.jsp file in WebContent folder. 以下代码位于WebContent文件夹中的Home.jsp文件中。 (WebContent->Home.jsp) (WebContent-> Home.jsp)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="0;url=A.jsp">
<title>Insert title here</title>
</head>
<body>

</body>
</html>

I also tried to change the url "A.jsp" to "WEB-INF/JSP/A.jsp" but failed. 我还尝试将URL“ A.jsp”更改为“ WEB-INF / JSP / A.jsp”,但失败了。

The code you wrote is correct. 您编写的代码是正确的。 All u need to do is place your jsp file A.jsp in the same folder or package as your AB.html is, or you can change the url attribute in meta tag to "/JSP/A.jsp". 您需要做的就是将jsp文件A.jsp与AB.html放在同一文件夹或包中,或者您可以将meta标签中的url属性更改为“ /JSP/A.jsp”。

您可以在浏览器中运行该页面,并且可以在程序员的控制台(chrome f12)上看到代码正在寻找资源的位置,以便可以相应地放置文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM