<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'ComplainUpdateList.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<img src="D:\eclipse\workspace\homework\WebContent\images\0.jpg"/>
</body>
</html>
显示的结果是无法读取图片。
急求解决方法!
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'ComplainUpdateList.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<img src="D:\eclipse\workspace\homework\WebContent\images\0.jpg"/>
</body>
</html>
显示的结果是无法读取图片。
急求解决方法!
即使按我写的,图片也是无法显示(不是打叉)?为什么?
其次试了一下火狐和IE浏览器,火狐上显示不了,IE上能显示。
所以首先你检查一下浏览器,换其他的浏览器试试。其次,如果在本地部署调试,绝对路径和相对路径都是可以的,建议用相对路径。当然如果上传到服务器上,则必须使用相对路径了,否则肯定是找不到图片资源的。
<img src="images/3.jpeg"/>
这是程序代码<img src="images/3.jpeg"
/
代码如下:
<img src="\images\3.jpeg" width="500px" height="280px"/>
还有,如果images文件夹如果和这个jsp的在同一层目录下,则前面就不要加"\",
直接"images/3.jpeg"。