Topic: Spring中关于URI的问题

  Print this page

1.Spring中关于URI的问题 Copy to clipboard
Posted by: subsky
Posted on: 2006-02-20 16:47

我将所有的jsp文件都放在/WEB-INF/view/下,同时配置文件中配置了如下信息:
     <property name="prefix">
       <value>/WEB-INF/view/</value>
     </property>
    
     <property name="suffix">
       <value>.jsp</value>
     </property>
如果我的某个jsp文件,比如main.jsp,要用到一些image文件和css文件,我该如何放置这些文件,从浏览器是无法直接访问/WEB-INF/目录的.在main.jsp文件中,该如何写这些资源文件的路径呢?
谢谢!

2.Re:Spring中关于URI的问题 [Re: subsky] Copy to clipboard
Posted by: floater
Posted on: 2006-03-07 21:57

should be in a dir that is parallel to /WEB-INF, a nonstandard convention is /static, under there you could have js, img, css

3.Re:Spring中关于URI的问题 [Re: floater] Copy to clipboard
Posted by: subsky
Posted on: 2006-03-08 10:13

floater wrote:
should be in a dir that is parallel to /WEB-INF, a nonstandard convention is /static, under there you could have js, img, css

这样的话
jsp文件在目录/WEB-INF/view下
静态资源文件在目录/static/下
jsp文件中可以这样书写 <img src="static/image/LOGO.gif" width="93" height="45"> ,是没有问题的

只是,如果通过dreamweaver来维护jsp界面的时候,img以及css的路径又找不到了还要重新配置……

4.Re:Spring中关于URI的问题 [Re: subsky] Copy to clipboard
Posted by: floater
Posted on: 2006-03-11 23:55

I remembered that there is a way to get around that, but couldn't remember the details.

could you add "/" in the front of static/.... This shouldn't have any effect on the java side. On the dreamweaver side, it will go to c:\static\.... to find it, so you need to duplicate static under c:\. Something similar to this worked for me before, but I can't recall the details.

5.Re:Spring中关于URI的问题 [Re: floater] Copy to clipboard
Posted by: zcjl
Posted on: 2006-03-12 00:02

floater wrote:
I remembered that there is a way to get around that, but couldn't remember the details.

could you add "/" in the front of static/.... This shouldn't have any effect on the java side. On the dreamweaver side, it will go to c:\static\.... to find it, so you need to duplicate static under c:\. Something similar to this worked for me before, but I can't recall the details.


html有个base标签,可以用以定义引用资源的起始目录

6.Re:Spring中关于URI的问题 [Re: subsky] Copy to clipboard
Posted by: subsky
Posted on: 2006-03-16 21:33

thanks ! Big Smile


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923