Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JSP·ÖÒ³2

ʹÓÃdiasplaytag×é¼þ¡£
ʹÓÃmysql5, ÓиöÊý¾Ý±íuser,×Ö¶ÎÓÐid, username, password¡£
ʹÓÃdisplaytagÐèµ¼Èëdisplaytag-1.1.jar£¬ºÍ
commons-logging
commons-lang
commons-collections
commons-beanutils
log4j
itext (optional, for pdf/rtf export)
È»ºóÔÚJSPÒ³ÃæÖзÅÈë<%@ taglib uri="http://displaytag.sf.net " prefix="display"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.sql.*,java.util.*,test.User"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<mce:style type="text/css" media="all"><!--
@import url("css/screen.css");
--></mce:style><style type="text/css" media="all" mce_bogus="1"> @import url("css/screen.css");</style>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>·ÖÒ³²âÊÔ2(ʹÓÃdiasplaytag×é¼þ)</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);

List list = new ArrayList();
while(rs.next()){
User user = new User(rs.getInt("id"), rs.getString("username"), rs.getString("password"));
list.add(user);
}

request.setAttribute("list",list);

rs.close();
stmt.close();
conn.close();


%>
<body>
<center>
<display:table name="list" pagesize="4"
class="ITS" >
<display:column property="username" title="̞" sortable="true"/>
<display:column property="


Ïà¹ØÎĵµ£º

Jsp Á¬½Ó mySQL¡¢Oracle Êý¾Ý¿â±¸Íü

Jsp Á¬½Ó mySQL¡¢Oracle Êý¾Ý¿â±¸Íü
2009-12-15 16:47
Jsp »·¾³Ä¿Ç°×îÁ÷ÐеÄÊÇ Tomcat5.0¡£Tomcat5.0 ×Ô¼º°üº¬Ò»¸ö Web ·þÎñÆ÷£¬Èç¹ûÊDzâÊÔ£¬¾Íû±ØÒª°Ñ Tomcat Óë IIS »ò Apache ¼¯³ÉÆðÀ´¡£ÔÚ Tomcat ×Ô´øµÄ Web ·þÎñÆ÷Ï¿ÉÒÔ½øÐÐ Jsp ²âÊÔ¡£
    °²×° Tomcat5.0 Ç°ÐèÒª°²×° JDK(Èç¹ûÊÇ Windows server ......

jspÄÚÖöÔÏó

1.request¶ÔÏó
  ¸Ã¶ÔÏó·â×°ÁËÓû§Ìá½»µÄÐÅÏ¢£¬Í¨¹ýµ÷ÓøöÔÏóµÄÏìÓ¦µÄ·½·¨¿ÉÒÔ»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢¡£
  µ±request¶ÔÏó»ñÈ¡Óû§Ìá½»µÄºº×Ö×Ö·ûʱ£¬»á²úÉúÂÒÂ룬ÓÉÏÂÃæµÄ·½·¨¿ÉÒÔ½â¾ö£º
  Sting  s2 = new   String(s1.getBytes("iso8859-1"),"GB2312")½øÐÐת»»¡£
 request³£Óõķ½·¨ ......

Html/Jsp³£ÓõÄÒ³ÃæÌøת·½·¨

µÚÒ»ÖÖ£º
<script language="javascript" type="text/javascript">
    window.location.href="login.jsp?backurl="+window.location.href;
</script>
µÚ¶þÖÖ£º
<script language="javascript">
    alert("·µ»Ø");
    window.history.back ......

Jsp±à³Ì

 JAVA×ÛºÏÃæÊÔÌ⣺ҳÃæµÄץȡ¡¢½âÎö¡¢±£´æÊý¾Ý¿âºÍÉú³ÉHTMLµÄÒ³Ãæչʾ ÊÕ²Ø
´ÎÀý×Ó¿ÉÒÔÓÃÀ´Ñ§Ï°ÍøÂç±à³Ì£¬ÕýÔò±í´ïʽµÄʹÓ㬷ºÐÍ£¬Êý¾Ý¿âµÄ»ù±¾²Ù×÷µÈJAVA֪ʶ
ÎÊÌâÈçÏ£ºÀ´Ô´ÓÚÂÛ̳
http://topic.csdn.net/u/20090616/13/59aa4e2d-3752-45df-9c1b-c65c46c3e4d7.html
дһ¸öjspÒ³Ã棬·ÃÎÊʱÏÔʾ´ÓÏÂÃæµÄÒ³ÃæÌ ......

¼òµ¥AjaxÓëJSPÏà½áºÏÒ³Ãæ

»·¾³£ºAjax+JSP£¬Tomcat5.05
²Î¿¼£ºhttp://www.w3cschool.cn/index-24.asp.htm
Îļþ£ºtestAjax.html
<!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=gb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ