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();
}
相关文档:
JS代码
<script
type="text/javascript">
function closewindow(){
window.returnValue = true;
window.close();
}
function clock(){
i = i -1;
if(document.getElementById("info")){
document.getElementById("info").innerHTML
......
JSP中结果集显示如下:
<
ww:iterator
value
=
"resultList"
status
=
"status"
>
<
tr
class
=
"<ww:if test="
#status.even"
>
row-even
</
ww:if
> ......
HTTP 通信协议是客户与服务器之间一种提交(请求) 信息与响应信息
(request/respone)的通信协议。在JSP 中,内置对象request 封装了用户提交的信息,
那么该对象调用相应的方法可以获取封装的信息,即使用该对象可以获取用户提交的信
息。
客户通常使用HTML 表单向服务器的某个JSP 页面提交信息,表单的一般格式是: ......
<%@ page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%
//在这里如果写成“WEB-INF\templates\template.htm”程序会报错
String filePath = request.getRealPath("/")+"WEB-INF/templates/template.htm"; &nbs ......
JSP基本语法与定义
先来看一段简单的小程序:
程序:
1.jsp
<html>
<head>
<title>example</title>
</head>
1
<%@ page language=”java” %>
2
<%@ page
contentType=”text/html,charset=”GB2312””>
3
......