JSP中利用数据源对象建立数据库连接
配置程序的运行目录与JDBC数据源:
<Context path="/test" docBase="F:\JSPLesson\test" reloadable="true">
<Resource name="jdbc/bookstore" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="root" password="123456"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/bookstore?autoReconnect=true"/>
</Context>
JSP中通过如下方式得到数据库连接:
<%
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/bookstore");
Connection conn = ds.getConnection();
%>
相关文档:
index.jsp:
<html>
<head>
<title>The News</title>
</head>
<body>
<h1> Latest News</h1>
<table>
<tr>
<td><h3><%@include file="items/news1.jsp" %></h3></td>
</tr>
<tr>
<td> ......
我们使用Google提供的iframe让jsp页面嵌入到flex中
首先,请到http://code.google.com/p/flex-iframe/下载iframe 的swc包
第二步,把swc包放入flex_libs中,如果不是web项目就放入lib下
第三步,创建一个mxml文件
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/ ......
member.jsp //session限制访问页
<%
String url = ""
if(session.getAttribute("username")==null)
{
url = myRedirect.dealurl(request);//记录当前地址和请求参数,dealurl将实际url处理了避免和要请求url有干扰,因为会有& 字符
......
http://www.soft6.com/tech/16/160477.html
实现tag的类(标签处理器)(tag handler)
1,是一些在引用了标签的JSP页面执行期间被Web Container调用以求自定义标签值的对象;
2,必须实现Tag, SimpleTag和BodyTag之一
3,可以继承TagSupport和BodyTagSupport之一
标签库的接口和类的继承关系接口的继承关系:  ......
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%@ page contentType="text/html; charset=gb2312" language="java"
import="java.sql.*"%>
<%
/*********************
&nb ......