1. 发起请求页面 //ImageClient.jsp
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>ImageRequest</TITLE>
</HEAD>
<BODY>
<img src="http://127.0.0.1:8080/ImageServer.jsp"/>
</BODY>
</HTML>
2. 接受请求并返回结果页 //ImageServer.jsp
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ page import="java.io.*"%>
<%
System.out.print("enter...")
String filePath = "C:/Program Files/Tomcat/Tomcat-7.0.4/webapps/ROOT/ericsson.gif"
File file = new File(filePath)
InputStream fis
try {
fis = new FileInputStream(file)
byte[] buf=new byte[(int)fis.available()]
fis.read(buf)
response.setContentType("application/binarycharset=ISO8859_1")
OutputStream outs = response.getOutputStream()
outs.write(buf)
outs.flush()
out.clear()
out = pageContext.pushBody()
} catch (FileNotFoundException e) {
e.printStackTrace()
} catch (IOException e) {
e.printStackTrace()
}
%>
3. 测试结果
<hgroup>标签是 HTML 5 中的新标签。作用如下:
<hgroup>标签用于对网页或区段(section)的标题进行组合。
写法如下:
使用 <hgroup>标签对网页或区段(section)的标题进行组合。
<hgroup>
<h1>Welcome to my WWF</h1>
<h2>For a living planet</h2>
</hgroup>
<p>The rest of the content...</p>