jsp有哪些内置对象?作用分别是什么?
JSP共有以下9种基本内置组件(可与ASP的6种内部组件相对应):
1.request 用户端请求,此请求会包含来自GET/POST请求的参数。
2. response 网页传回用户端的回应 。
3.pageContext 网页的属性是在这里管理 。
4.session 与请求有关的会话期。
5.application servlet 正在执行的内容。
6.out 用来传送回应的输出。
7.config servlet的构架部件。
8.page JSP网页本身。
9.exception 针对错误网页,未捕捉的例外。
相关文档:
一、jsp连接Oracle8/8i/9i数据库(用thin模式)
testoracle.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Stri ......
try {
URL url = new URL("http://www.163.com");
InputStream is = url.openStream();
byte[] buffer = new byte[1024];
  ......
<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if ......
以前有提到过乱码问题,最近在使用window.open时又出现此类问题,现解决如下:
1:使用encodeURIComponent函数对参数进行处理,例如:window.open("html.jsp?name=" + encodeUrlComponent(value)));
2:修改tomcat服务器的server.xml文件添加:useBodyEncodingForURI="true"或者
URIEncoding=" ......
JSP中有两种包含语句:
1. <%@include file="head.jsp" %>
2. <jsp:include page="head.jsp" />
或者:
<jsp:include page="jieshou.jsp">
<jsp:param name="canshu" value="magci" />
&nbs ......