⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 choosedir.jsp

📁 “JSP数据库项目案例导航”一书从第一章到第十一章各章实例的源程序文件以及数据库文件。 注意: 1. 本书中的案例提供的数据库环境不同
💻 JSP
字号:
<%@page language="java" contentType="text/html;charset=GBK"%>
<%@page import="java.util.*,java.text.*,oa.main.DealString,javax.swing.tree.DefaultMutableTreeNode,java.util.Hashtable"%>
<script language="javascript" src="../scripts/department.js"></script>
<script language="javascript" src="../scripts/treeBrower.js"></script>
<%@include file="../../inc.jsp"%>


<html>
<head>
<title>个人文件柜文件夹浏览</title>
<link href="../css/person.css" type=text/css rel=stylesheet>
</head>

  <q id="this" align=left>
			转移到&nbsp;&nbsp;<input type=text value="根目录" class=fashion id=0 name="txt_filefolder" readonly>
			<input type="submit" value="确定" onclick="mvFile()">
			<input type="button" value="取消" onclick="window.close();">
			<hr>
    <table id="t1" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="D0E7FF" width="95%" height="2">
       <tr><td>
			<input type="button" value="全部展开" class=fashion onmouseover="msover();" onmouseout="msout();"onclick="allopen()">
			&nbsp;
			<input type="button" value="全部折叠" class=fashion onmouseover="msover();" onmouseout="msout();"onclick="allclose()">
		  </td>
	   </tr>
     </table>
	<table border="1" cellpadding="2" style="border-collapse: collapse; color:#FFFFFF" bordercolor="D0E7FF" width="95%" height="18" bgcolor="#007EAE">
	  <tr>
	    <td align="left" width="100%">&nbsp;<b>个人文件柜文件夹浏览</b></td>
	  </tr>
	</table>
  
<%	
oa.bean.PersonFileBean myBean = null;
try{
	myBean = new oa.bean.PersonFileBean();
	if(myBean.getConn()==null)
	{
		%>		
		数据库无法响应,请<a href="javascript:window.history.back(-1);">返回</a>重试
		<%out.close();
	}

		DealString ds=new DealString();
		
		String strPersonNo=ds.toString((String)request.getParameter("zgbh"));
        myBean.setPersonID(strPersonNo);
		int sub = 1;
		int nItem = 0;
		String outPrint = "";
		String strFolder = "";
		String tHead1="<div style=\"display:none\"  id=\"" ;
		String tHead2="\"><table><tr>";
		String tEnd="</tr></table></div>"; 

		DefaultMutableTreeNode myTree = myBean.buildFolderTree();
		DefaultMutableTreeNode root, currentNode, lastNode;
		root = myTree;
		outPrint = "根目录";//(String) ((Hashtable) root.getUserObject()).get("WJMC");
		strFolder = (String) ((Hashtable) root.getUserObject()).get("WJBH");



%>
<!-- 处理根节点------------------------------------------------------------------- -->
   
	<table border="1" cellpadding="2" style="border-collapse: collapse; color:#FFFFFF" bordercolor="D0E7FF" width="95%" height="18" >
	  <tr>
		<td ><q class="MOUT" onclick=<%="\"Expand("+nItem+");changefolder('"+outPrint+"',"+strFolder+");\""%> style="cursor:hand;"><img id='0' src="../images/plus.gif" >&nbsp;<font color="blue"><b><%=outPrint%></b></font></q></td>
	  </tr>
	</table>
<!----------------------------------------------------------------------------- -->
    
<%
//		out.println("Root:" + root);

		
	if (root.getChildCount()!=0){
		currentNode = (DefaultMutableTreeNode) root.getFirstChild();
		sub++;
		out.println(tHead1+nItem+tHead2);
		while ((currentNode != null) && (currentNode != root)) {
			outPrint = (String) ((Hashtable) currentNode.getUserObject()).get("WJMC");
			strFolder = (String) ((Hashtable) currentNode.getUserObject()).get("WJBH");
			DefaultMutableTreeNode cNode;
			cNode = currentNode;
			while(cNode!=root){
				cNode = (DefaultMutableTreeNode) cNode.getParent();
				String strWJBH = (String) ((Hashtable) cNode.getUserObject()).get("WJBH");
				strFolder += ","+strWJBH;
			}

%>
		<table border="1" cellpadding="2" style="border-collapse: collapse; color:#FFFFFF" bordercolor="D0E7FF" width="95%" height="18"><tr><td >
<%
			//控制
			for (int i = 1; i < sub; i++)
				out.print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
			if ((currentNode.getChildCount()) != 0) {
				nItem++;
%>
<!-- 处理有子节点的树---------------------------------------------------    -->
		
		<q class="MOUT" onclick=<%="\"Expand("+nItem+");changefolder('"+outPrint+"','"+strFolder+"');\""%> style="cursor:hand;"><img id='<%=nItem%>' src="../images/plus.gif" ><font color="blue">&nbsp;<b><%=outPrint%></b></font>
	   </q>		
		</td>
		</tr></table>


<!-- -----------------------------------------------------------    -->
<%

			
			out.println(tHead1+nItem+tHead2);	


			} else{

%>
<!-- 处理无子节点的叶---------------------------------------------------    -->
		<q class="MOUT" onclick=<%="\"changefolder('"+outPrint+"','"+strFolder+"');\""%> style="cursor:hand;">
		   &nbsp;&nbsp;<font color="blue"><b><%=outPrint%></b></font>
	   </q>	
		</td>
		</tr></table>

<!-- -----------------------------------------------------------    -->
<%			}
			if ((currentNode.getChildCount()) == 0) {
				if ((currentNode.getNextSibling() == null)) {
					//当前节点即没有子节点又没有兄弟节点,则返回父节点
					currentNode =
						(DefaultMutableTreeNode) currentNode.getParent();
					sub--;
					out.println(tEnd);
					if (currentNode == null)
						continue;

				}
			} else {
				//当前节点有子节点
				currentNode =
					(DefaultMutableTreeNode) currentNode.getFirstChild();
				sub++;
				continue;
			}

			lastNode = currentNode.getNextSibling();
			if (lastNode != null) {
				currentNode = lastNode;

			} else {
				while ((currentNode.getNextSibling() == null)&&(currentNode!=root)) {

					currentNode =
						(DefaultMutableTreeNode) currentNode.getParent();
					sub--;
					out.println(tEnd);
				}
				currentNode = currentNode.getNextSibling();
			} //end if else

		}

	}
		out.println("</Table></div>");
	
%>

</q>
</html>
<script>
Expand(0);
function mvFile()
{			
	window.close();
	var target=document.all.txt_filefolder.id;
	window.opener.form1.txt_cmd.value = "moveToDIR";
	window.opener.form1.action = "../../PersonFileServlet?targetFolder="+target;
	window.opener.form1.submit();
}
function changefolder(name,id)
{
	document.all.txt_filefolder.id=id;
	document.all.txt_filefolder.value=name;
}
</script>
<%}catch(Exception e){oa.main.Logger.log("ERROR:oa.person.chooseDIR.jsp=>");e.printStackTrace(oa.main.Logger.log);}
finally{
	if(myBean!=null)myBean.closeConn();
}%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -