相对网址和绝对网址的区别 [英] relative url and absolute url difference
问题描述
servlet容器中的相对URL和绝对URL有什么区别.例如,如果在webinf文件夹下有一个名为forum.jsp的jsp.当我想将当前请求从同一webinf文件夹下的当前jsp文件分派到jsp时,是以下正确方法
What is the difference between relative and absolute url in servlet container. for example if there is an jsp called forum.jsp under webinf folder. when i want dispatch the current request to the jsp from the current jsp file which is under the same webinf folder, is the following correct way
/forum.jsp
/forum.jsp
相对URL表示相对于web-inf文件夹或jsp位置的相对地址.
relative url means relative to the web-inf folder or to the jsp location.
推荐答案
绝对URL 为:http://stackoverflow.com/questions/3591899/relative-url-and-absolute-url-difference
和相对URL 是:/questions/3591899/relative-url-and-absolute-url-difference
此外, 相对URL 可以只是:../questions/3591899/relative-url-and-absolute-url-difference
取决于链接页面的位置...
Also, a relative URL can be just: ../questions/3591899/relative-url-and-absolute-url-difference
depending where is the linking page located...
或./3591899/relative-url-and-absolute-url-difference
(如果链接页面位于questions
文件夹上)
Or ./3591899/relative-url-and-absolute-url-difference
if the linking page is located on the questions
folder
我建议始终使用相对URL ...,并且努力,继续尝试使用它们...
I will suggest to always use Relative URL... and it goes hard, keep trying to use them...
一个问题,为什么您的JSP位于WEB-INF/
文件夹中?
One question, why your JSPs are in the WEB-INF/
folder?
您无权访问WEB-INF
文件夹下的JSP
,如果尝试访问它,服务器将抛出404 error
. J2EE
仅在此文件夹下查找类和库.
You don't have access to JSP
under the WEB-INF
folder, if you try to access it the server will throw a 404 error
. J2EE
only looks for classes and libraries under this folder.
这篇关于相对网址和绝对网址的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!