jsp中通过URL地址获取该地址页面中的静态页面
try {
URL url = new URL("http://www.163.com");
InputStream is = url.openStream();
byte[] buffer = new byte[1024];
int i;
while((i = is.read(buffer)) != -1){
System.out.println(new String(buffer,0,i));
}
} catch (Exception e) {
e.printStackTrace();
}
相关文档:
哪位高手能帮我看下为什么抛出这些异常?
代码
<%@ page language="java" import="java.util.*" contentType="text/html; charset=ISO-8859-1"
pageEncoding="GB2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
< ......
HTML 注释
在客户端显示一个注释.
JSP 语法
<!-- comment [ <%= expression %> ] -->
例子 1
<!-- This file displays the user login screen -->
在客户端的HTML源代码中产生和上面一样的数据:
<!-- This file displays the user login screen -->
例子 2
<!-- This page was ......
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>index</title>
<meta http-equiv="pragma" content="no-cache"&g ......
JSP基本语法与定义
先来看一段简单的小程序:
程序:
1.jsp
<html>
<head>
<title>example</title>
</head>
1
<%@ page language=”java” %>
2
<%@ page
contentType=”text/html,charset=”GB2312””>
3
......
用了commons-fileupload-1.2.jar和commons-io-1.3.2.jar这两个包。
save.jsp
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.regex.*"%>
<%@ page import="org.apache.co ......