由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 请问JSP里这个怎么设
相关主题
HTTP Status 404 The requested resource (/abc/index.jsp) is not available.Re: tomcat作server,jsp访问的文件必须在webapps/ROO
[转载] JSP access database的问题[转载] javascript怎么访问JSP里的arraylist?
菜鸟请教版上大虾--如何用Java建一个连接Dababase的Tomcat网页大家愿意讨论一下log4j么
问个J2EE server跟Apache Web Server的问题?求助!Tomcat下设置servlets的问题
Run Servlet with TomcatJava虚拟磁盘问题
tomcat作server,jsp访问的文件必须在webapps/ROOT/?tomcat 访问硬盘文件的问题, 3x
Tomcat JSP syntax errorJ2EE: why is my .jsp not refreshed?
j2ee启动时, 启动了tomcat吗?tomcat连接mysql求助
相关话题的讨论汇总
话题: jsp话题: href话题: woomy话题: root话题: link
进入Java版参与讨论
1 (共1页)
w***y
发帖数: 6251
1
【 以下文字转载自 Programming 讨论区 】
【 原文由 woomy 所发表 】
我现在用jsp做网页, 用tomcat 做jsp server
我知道硬盘上一个txt文件的绝对路径, 譬如path=/home/woomy/text.txt
我想做个link可以指向这个文件,用户click这个link可以打开这个文件,
可是我试了一下link 不行
我把鼠标放在link上的时候状态栏显示的是
http://hostname:port/home/woomy/test.txt
我知道tomcat是到他的webapps/root下面找文件, 请问这个href该怎么设呢?
多谢多谢!
?
x***n
发帖数: 39
2
Your local files are secured, unless you
explicitly share them, either by copying the files
under the directory that was set as Tomcat's web root,
or create some virtual directory under that root.
Don't know if a softlink works or not.

【在 w***y 的大作中提到】
: 【 以下文字转载自 Programming 讨论区 】
: 【 原文由 woomy 所发表 】
: 我现在用jsp做网页, 用tomcat 做jsp server
: 我知道硬盘上一个txt文件的绝对路径, 譬如path=/home/woomy/text.txt
: 我想做个link可以指向这个文件,用户click这个link可以打开这个文件,
: 可是我试了一下link 不行
: 我把鼠标放在link上的时候状态栏显示的是
: http://hostname:port/home/woomy/test.txt
: 我知道tomcat是到他的webapps/root下面找文件, 请问这个href该怎么设呢?
: 多谢多谢!

c**g
发帖数: 274
3
if it is under unix/linux, you can set a link (using ln) to text.txt
from doc root of your web application.
If it is under windows, set a shortcut, but I am not sure if this
works.
another solution, you create a jsp, which reads text.txt and displays
it.

【在 w***y 的大作中提到】
: 【 以下文字转载自 Programming 讨论区 】
: 【 原文由 woomy 所发表 】
: 我现在用jsp做网页, 用tomcat 做jsp server
: 我知道硬盘上一个txt文件的绝对路径, 譬如path=/home/woomy/text.txt
: 我想做个link可以指向这个文件,用户click这个link可以打开这个文件,
: 可是我试了一下link 不行
: 我把鼠标放在link上的时候状态栏显示的是
: http://hostname:port/home/woomy/test.txt
: 我知道tomcat是到他的webapps/root下面找文件, 请问这个href该怎么设呢?
: 多谢多谢!

w***y
发帖数: 6251
4

thx a lot! But it has to be a hard link, I tried ln -s first, failed:(

【在 c**g 的大作中提到】
: if it is under unix/linux, you can set a link (using ln) to text.txt
: from doc root of your web application.
: If it is under windows, set a shortcut, but I am not sure if this
: works.
: another solution, you create a jsp, which reads text.txt and displays
: it.

B******N
发帖数: 445
5
It's browser interpret "/" as your application root. not jsp in this case.
the browser always get other files relative to this page or relative to the
tag if it exists. If browser find the url init with "/" it will always
go to web application root to find the path.
now you should know how to set.

【在 w***y 的大作中提到】
:
: thx a lot! But it has to be a hard link, I tried ln -s first, failed:(

1 (共1页)
进入Java版参与讨论
相关主题
tomcat连接mysql求助Run Servlet with Tomcat
servlet-mapping causing http 404 errortomcat作server,jsp访问的文件必须在webapps/ROOT/?
请教一个maven 管理项目的问题Tomcat JSP syntax error
Re: 一个最近完成的JAVA项目的反思。j2ee启动时, 启动了tomcat吗?
HTTP Status 404 The requested resource (/abc/index.jsp) is not available.Re: tomcat作server,jsp访问的文件必须在webapps/ROO
[转载] JSP access database的问题[转载] javascript怎么访问JSP里的arraylist?
菜鸟请教版上大虾--如何用Java建一个连接Dababase的Tomcat网页大家愿意讨论一下log4j么
问个J2EE server跟Apache Web Server的问题?求助!Tomcat下设置servlets的问题
相关话题的讨论汇总
话题: jsp话题: href话题: woomy话题: root话题: link