JSP·ÖÒ³1
×Ô¼º·ÖÒ³£¬ÏÂһƪ»á½éÉÜʹÓÃdiasplaytag×é¼þ¡£
ʹÓÃmysql5, ÓиöÊý¾Ý±íuser,×Ö¶ÎÓÐid, username, password¡£
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>·ÖÒ³²âÊÔ</title>
</head>
<%
String driver = "com.mysql.jdbc.Driver";
String username = "root";
String password = "leng";
String url = "jdbc:mysql://localhost/test";
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Class.forName(driver);
conn = DriverManager.getConnection(url, username, password);
stmt = conn.createStatement();
String sql = "select * from user order by id asc";
rs = stmt.executeQuery(sql);
%>
<%
int countRecord = 0; //×ܼǼÊý
int pageSize = 4; // ÿҳ¼Ç¼Êý
int countPage = 0 ; // ×ÜÒ³Êý
int dipage = 1; // µ±Ç°Ò³Â룬ĬÈÏ´Ó1¿ªÊ¼
String pages = request.getParameter("page");
if(pages == null ){
pages = "1";
}
dipage = Integer.parseInt(pages);
rs.last();
countRecord = rs.getRow();
if(countRecord % pageSize == 0){
countPage = countRecord / pageSize;
} else {
countPage = countRecord / pageSize + 1;
}
if((dipage-1)*pageSize == 0){
// µÚÒ»Ò³
rs.beforeFirst();
} else {
rs.absolute((dipage-1)*pageSize);
}
%>
<body>
<center>
<h3>·ÖÒ³²âÊÔ</h3>
<table border="1">
<tr>
<th width="100">id</th>
<th width="300">̞</th>
<th width="300">ÃÜÂë</th>
</tr>
<%
// ¿ØÖÆÿҳÏÔʾÊý
int i = 0;
while(rs.next()){
%>
<tr>
<td><%=rs.getInt("id") %></td>
&l
Ïà¹ØÎĵµ£º
1.FCKeditor ½éÉÜ
FCKeditor Õâ¸ö¿ªÔ´µÄHTML Îı¾±à¼Æ÷¿ÉÒÔÈÃweb ³ÌÐòÓµÓÐÈçMS Word ÕâÑùÇ¿´óµÄ±à¼¹¦ÄÜ£¬.FCKeditor Ö§³Öµ±Ç°Á÷ÐеÄä¯ÀÀÆ÷¡£
2£®×¼±¸¹¤×÷£º
»·¾³£ºwinddows XP¡¢tomcat6.0¡¢JDK1.6
ÏÂÔØ£º
1)£ºFCKeditor_2.6.4.zip
µØÖ·£ºhttp://nchc.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.6.4.zip ......
¼¸ºõËùÓеÄWeb¿ª·¢ÓïÑÔ¶¼Ö§³ÖSession¹¦ÄÜ£¬ServletÒ²²»ÀýÍâ¡£ Servlet/JSPÖеÄSession¹¦ÄÜÊÇͨ¹ý×÷ÓÃÓò(scope)Õâ¸ö¸ÅÄîÀ´ÊµÏֵġ£
×÷ÓÃÓò·ÖΪËÄÖÖ£¬·Ö±ðΪ£º
page
ÔÚµ±Ç°Ò³ÃæÓÐЧ(½öÓÃÓÚJSPÖÐ)
request
ÔÚµ±Ç°ÇëÇóÖÐÓÐЧ
session
ÔÚµ±Ç°»á»°ÖÐÓÐЧ
application
ÔÚËùÓÐÓ¦ÓóÌÐòÖÐÓÐЧ
ÊDz»ÊÇ¿´²»Ì«Ã÷°×£¿pageÒòΪ½ ......
±êÇ©¿âTaglib
±êÇ©±»¶¨ÒåºÍ·Ö²¼ÔÚÒ»¸ö³ÆΪ±êÇ©¿âµÄ½á¹¹ÖУ¬Ò»¸ö±êÇ©¿âÊÇÓÉÔªÐÅÏ¢ºÍÀà×é³ÉµÄ¼¯ºÏ£º
1.±êÇ©´¦ÀíÆ÷£ºÊµÏÖ¶¨ÖƱêÇ©¹¦ÄܵÄJavaÀà¡£
2.±êÇ©¸½¼ÓÐÅÏ¢£¨TEI£©£ºÏòJSPÈÝÆ÷Ìṩ±ß¼ÒÔÈ·ÈϱêÇ©ÊôÐԺʹ´½¨±äÁ¿µÄÀà¡£
3.±êÇ©¿âÃèÊöÆ÷£¨TLD£©£ºÃèÊöµ¥¸ö±êÇ©ºÍÕû¸ö±êÇ©¿âÊôÐÔµÄXMLÎĵµ¡£
±êÇ©´¦ÀíÆ÷ºÍ±êÇ©¸½¼ÓÐÅÏ¢Ðè ......
JspÁ¬½ÓMSSQL2000µÄÁ½ÖÖ·½·¨
×î½üÔÚѧϰJSPWeb£¨Tomcat·þÎñÆ÷£©Ó¦Óÿª·¢ºÍ»ùÓÚWeblogicºÍMyelcipseµÄJEE5µÄ¿ª·¢£¬ÔÚѧϰ¹ý³ÌÖÐÉæ¼°µ½Á¬½ÓSQL 2000 Êý¾Ý¿âʱ£¬ÓÉÓÚÈí¼þ»·¾³µÄ²îÒìÐÔºÍһЩ°æ±¾ÎÊÌ⣬»¨Á˺ô󹦷ò²ÅÁ¬ÉÏ£¬ËùÒÔÔÚ´Ë×÷¸ö×ܽᣬϣÍûÄܸø´ó¼ÒһЩ°ïÖú£¬²»ÒªÔÚ»ù±¾µÄ¶«Î÷ÉÏ»¨·ÑÌ«¶àµÄʱ¼ä¡£
·½·¨Ò»£ºÀûÓÃSQL Se ......