注册 登录
编程论坛 J2EE论坛

一个让我抓狂的问题

枫叶·飘 发布于 2013-09-04 20:07, 2212 次点击
老师布置了一个用jsp做个简单的自我介绍的页面
我先用dw做了个简单的页面 然后把源代码复制过去
最后出现了一个问题 就是在myeclipse中设计的时候可以看到图片
但是用浏览器浏览的时候却显示不了图片 不管是自带的浏览器 还是ie 都不行


我的图片放在 Webroot 下
源代码如下

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title> <style type="text/css">
body {
background-image: url(20121019143034859.jpg);
color: #00F;
}
.自我介绍 {
font-family: "楷体";
color: #FFF;
font-size: 36px;
}
.把握 {
font-family: "微软雅黑";
color: #0000FF;
}
.专业 {
color: #00F;
}
</style>
</head> <body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
<table width="200" border="0" align="center">
<tr>
<td align="center"><h1 class="自我介绍"> 自我介绍</h1></td>
</tr>
</table>
<table width="528" border="1" align="center" bordercolor="#0066FF">
<tr>
<td width="281" rowspan="5"><img src="123.jpg" width="344" height="452" /></td>
<td width="237" height="56" bgcolor="#CCCCCC"><p><strong>姓名:xx</strong></p></td>
</tr>
<tr>
<td height="60" bgcolor="#CCCCCC"><strong>年龄:21</strong></td>
</tr>
<tr>
<td height="60" bgcolor="#CCCCCC"><strong>籍贯:贵州</strong></td>
</tr>
<tr>
<td height="60" bgcolor="#CCCCCC"><span class="专业"><strong>专业:软件工程</strong></span><strong></strong></td>
</tr>
<tr>
<td height="60" bgcolor="#CCCCCC" class="把握"><p>把握生命的每一分钟</p>
<p>把握生命的每一次感动</p></td>
</tr>
</table>
</body>
<footer> <p align="center">版权所有 &copy; 111714127 xx</p> </footer>
</html>
4 回复
#2
ren8292013-09-05 11:34
那要看你这个html文件放到什么地方了,如果是Webroot 同一个文件夹里,那你的图片地址前要加上 Webroot/ 这样才能找到图片地址
#3
ren8292013-09-05 11:36
还有头一次看见用css中文类名的.
#4
cai4105795172013-09-07 13:48
看路径是否有错  最好到myeclipse里面的时候把图片放到webroot底下  然后在myeclipse里面改下路径 这样就肯定能看到图片了
#5
java小蚂蚁2013-09-13 09:29
用绝对路径,定位图片
1