怎样在jsp页面中加入图片啊?

spark07 2006-12-07 10:17:41
我想在我的jsp页面中加入一张美女图片,图片名字:beauty.jpg.我用<img src="beauty.jpg的硬盘地址"></img>却不行,图片根本就显示不出来,我听一兄弟说图片的地址要用相对地址,不知道怎么用啊?
小弟是新手,还麻烦各位大哥帮忙!
小弟谢谢了先!!!
...全文
2537 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
spark07 2006-12-07
  • 打赏
  • 举报
回复
用无为一本大哥的方式可以运行,但运行结果中没有图片的任何信息.
不知道问题出在哪里啊?!?!
spark07 2006-12-07
  • 打赏
  • 举报
回复
不中啊,用小丑大哥的方式编译结果如下:
nit:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
Compiling 1 source file to E:\new\godson\MyWebApp1\build\generated\classes
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:58: 未结束的字符串字面值
out.print(beauty.jpg>"></img>
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:60: -source 1.4 中不支持泛型
(请使用 -source 5 或更高版本以启用泛型)
<h1>This is JSP Page</h1>
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:60: 非法的表达式开始
<h1>This is JSP Page</h1>
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:60: 需要 ';'
<h1>This is JSP Page</h1>
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:60: 需要 ';'
<h1>This is JSP Page</h1>
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:60: 非法的类型开始
<h1>This is JSP Page</h1>
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:62: 非法的类型开始
<%--
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:63: 需要 ';'
This example uses JSTL, uncomment the taglib directive above.
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:63: 需要 ';'
This example uses JSTL, uncomment the taglib directive above.
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:63: 不是语句
This example uses JSTL, uncomment the taglib directive above.
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:63: 需要 ';'
This example uses JSTL, uncomment the taglib directive above.
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:63: 需要 ';'
This example uses JSTL, uncomment the taglib directive above.
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:63: 需要 ';'
This example uses JSTL, uncomment the taglib directive above.
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:64: 需要 ';'
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:64: 需要 ';'
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:64: 不是语句
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:64: 需要 ';'
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:65: 需要 :
--);
^
E:\new\godson\MyWebApp1\build\generated\src\org\apache\jsp\index_jsp.java:64: 不是语句
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
^
19 错误
E:\new\godson\MyWebApp1\nbproject\build-impl.xml:364: The following error occurred while executing this line:
E:\new\godson\MyWebApp1\nbproject\build-impl.xml:149: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 4 seconds)
图片beauty.jpg的路径:E:\new\godson\MyWebApp1\beauty.jpg
baobao28 2006-12-07
  • 打赏
  • 举报
回复
如果是提交以后的页面,路径要写成
<img src="/工程名/文件夹名/xx.jpg">
spark07 2006-12-07
  • 打赏
  • 举报
回复
好的,我知道了,谢谢小丑大哥和无为一本大哥!
我试一下先!
fzlotuscn 2006-12-07
  • 打赏
  • 举报
回复
假设你应用目录myapp 你就把你的jpg 放在目录下

<img src="xx.jpg">
thisyear 2006-12-07
  • 打赏
  • 举报
回复
<img src="硬盘地址/<%=beauty.jpg>"></img>

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧