JSPʵÏÖÊ÷Ðνṹ
//ת×Ôhttp://blog.csdn.net/zqhf8/archive/2007/07/09/1683938.aspx
1¡£ÔÀí¼ò½é
dtreeÊÇÒ»¸öÃâ·ÑµÄjavascript½Å±¾£¬Ö»Ð趨ÒåÓÐÏ޵ļ¸¸ö²ÎÊý£¬¾Í¿ÉÒÔ×ö³öƯÁÁµÄÊ÷ÐͲ˵¥¡£ÏÂÔØĿ¼£ºhttp://www.destroydrop.com/javascripts/tree/
ÒÔÏÂÊÇdtreeµÄÓ÷¨Ê¾Àý£º
1£©³õʼ»¯²Ëµ¥
<script type="text/javascript">
<!--
var Tree = new Array;
// nodeId | parentNodeId | nodeName | nodeUrl
Tree[0] = "1|0|Page 1|#";
Tree[1] = "2|1|Page 1.1|#";
Tree[2] = "3|1|Page 1.2|#";
Tree[3] = "4|3|Page 1.2.1|#";
Tree[4] = "5|1|Page 1.3|#";
Tree[5] = "6|2|Page 1.1.1|#";
Tree[6] = "7|6|Page 1.1.1.1|#";
Tree[7] = "8|6|Page 1.1.1.2|#";
Tree[8] = "9|1|Page 1.4|#";
Tree[9] = "10|9|Page 1.4.1|#";
Tree[10] = "11|0|Page 2|#";
//-->
</script>
2£©µ÷Óú¯Êý
<div class="tree">
<script type="text/javascript">
<!--
createTree(Tree,1,7); // starts the tree at the top and open it at node nr. 7
//-->
</script>
</div>
ÏÔÈ»£¬Èç¹ûÓö¯Ì¬µÄ½Å±¾À´³õʼ»¯²Ëµ¥Êý×飨asp,jsp¾ù¿É£©£¬ÄǾͿÉÒԺܷ½±ãµÄʵÏÖ¶¯Ì¬µÄÊ÷ÐͲ˵¥ÁË¡£
2¡£jsp¶¯Ì¬ÊµÏÖ
·ÖÒÔϲ½ÖèʵÏÖ¶¯Ì¬µÄÊ÷ÐͲ˵¥£º
1£©ÔÚÊý¾Ý¿â½¨tree_info±í£¬ÓÐnodeId£¬parentNodeId£¬nodeName£¬nodeUrlËĸö×ֶΣ¬À´´æ´¢½ÚµãÐÅÏ¢¡£
2£©±àдjavaÀ࣬ÓÃÓÚ´ÓÊý¾Ý¿âÕÒ³ö½ÚµãÐÅÏ¢£¬²¢ÇÒÉú³Éjavascript½Å±¾¡£
3£©±àдtagÀà¡£ÓÃÓÚ·â×°Âß¼£¬¼ò»¯jspµÄ¿ª·¢¡£
4£©½¨Ò»¸öweb³ÌÐò½øÐвâÊÔ¡£
3¡£Ïêϸ¹ý³Ì
1£©ÔÚÊý¾Ý¿â½¨±í£¬½Å±¾ÈçÏ£º
CREATE TABLE `test`.`tree_info` (
`node_id` INTEGER UNSIGNED NOT NULL DEFAULT -1,
`parent_id` INTEGER UNSIGNED NOT NULL DEFAULT -1,
`node_name` VARCHAR(45) NOT NULL,
`ref_url` VARCHAR(45) NOT NULL,
PRIMARY
Ïà¹ØÎĵµ£º
Á¬½ÓACCESSÊý¾Ý¿âµÄ¼òµ¥JSP´úÂ룺
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@ page import="java.sql.*" %>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
String url="jdbc:odbc:Driver={MicroSoft Access Drive ......
document.getElementById("flag")ÔÚieÖУ¬jspÖеÄÔªËØûÓÐidÖµ£¬ÓÐnameֵʱ£¬Ò²Äܲé³öÀ´£¬°´ÕÕnameÖµ²é¡£
µ«ÊÇÔÚfirefoxÖУ¬Èç¹ûûÓÐidÖµ£¬Ôò²é²»³öÀ´¡£ËùÒÔieÖУ¬nameºÍidÓÐʱͨÓ㻵«ÊÇfirefoxÖУ¬ÊÇÓÐÕâÑϸñÇø±ðµÄ¡£ ......
request request±íʾHttpServletRequest¶ÔÏó¡£Ëü°üº¬ÁËÓйØä¯ÀÀÆ÷ÇëÇóµÄÐÅÏ¢£¬²¢ÇÒÌṩÁ˼¸¸öÓÃÓÚ»ñÈ¡cookie, header, ºÍsessionÊý¾ÝµÄÓÐÓõķ½·¨¡£
response response±íʾHttpServletResponse¶ÔÏ󣬲¢ÌṩÁ˼¸¸öÓÃÓÚÉèÖÃËÍ»Ø ä¯ÀÀÆ÷µÄÏìÓ¦µÄ·½·¨£¨Èçcookies,Í·ÐÅÏ¢µÈ£©
out out ¶ÔÏóÊÇjavax.jsp.JspWriterµÄÒ»¸öʵÀý£¬ ......
ÔÚJspÖе÷ÓÃSerlvetÖÐÒѾ´æ´¢ÁËÐÅÏ¢µÄ JavaBean.
ServletÖÐÒѾ°ÑÊý¾Ý¿âµÄÐÅÏ¢±£´æµ½JavaBeanÖÐ,ÔÙ°ÑJavaBean±£´æµ½SessionÖÐ.
Jsp¿ªÊ¼µ÷ÓÃ:
<jsp:useBean id="key" type="ClassName" scope="Session" />
<jsp:getProperty name="key" property="PropertyName" />
ÎÞ·¨¶Á³öÐÅÏ¢:
ÔÒò: JavaBean ÖÐÊôÐÔµ ......
ÔÚtomcatÏÂÕÒµ½tomcat -> conf -> server.xml ÔÚÕâÒ»¾äÖÐÌí¼ÓºìÉ«²¿·Ö
<Connector connectionTimeout="20000" port="9090" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true"
/> <!--URLEncoding=""--> ± ......