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

📄 jspbean.java

📁 一个信息发布系统 基于jsp+servlet+tomcat 用户分管理员跟普通用户 普通用户有发布信息 查询信息 修改信息 回复信息 管理员拥有普通用户的功能 此外还具有删除信息 管理信息的回复的功能
💻 JAVA
字号:
package model;

import java.io.PrintWriter;
import java.sql.SQLException;
import java.sql.*;
import control.GetConnection;

public class JspBean {

	private PrintWriter out;

	public PrintWriter getOut() {
		return out;
	} 

	public void setOut(PrintWriter out) {
		this.out = out;
	}

	public void showTree(Connection con, String PCName,double left,double top) //构造PCName的弹出式菜单
	{
		try {
			String CCName = "";
			String CPath="";
			boolean HasChild;
			String sql2 = "select CCName,HasChild, CPath from Relation where PCName='" + PCName + "'";
			Statement st = con.createStatement();
			ResultSet rs2 = st.executeQuery(sql2);
			int total = 0;
			int height = 0;
			rs2.last();
			total = rs2.getRow();
			rs2.beforeFirst();
			
			if (total != 0) {
				height = 15*total;
				out.println("<div id=" + PCName + " style='position:absolute; left:" + left + "px; top:"+top+"px; width:105px; height:"+height+"px; z-index:2; background-color: #81F781; layer-background-color: #999966; border: 0px none #000000; visibility: hidden'" + " onMouseOver=MM_showHideLayers('" + PCName + "','','show')" + " onMouseOut=MM_showHideLayers('"+ PCName + "','','hide')>");
				out.println("<table width=100% cellspacing=0 cellpadding=2 height="+height+">");
				while (rs2.next()) //依次构造该分类的tr
				{
					CCName = rs2.getString("CCName");
					CPath=rs2.getString("CPath");
					HasChild = rs2.getBoolean("HasChild");
					if (HasChild) //如果存在子分类  
					{
						out.println("<tr><td width=40 onMouseOver=MM_showHideLayers('" + CCName + "','','show') onMouseOut=MM_showHideLayers('" + CCName + "','','hide')><b><font color=#FFFFFF><a href =\"ShowAllCardList?cpath="+CPath+"&cname="+CCName+"&pagecount=1&pagenum=1&command=show&sortcondition=byTime\" target=\"aa\">"  +  CCName  +   "</a></font></b> </td></tr> ");
					} 
					else
						out.println("<tr><td width=40><b><font color=#FFFFFF><a href =\"ShowAllCardList?cpath="+CPath+"&cname="+CCName+"&pagecount=1&pagenum=1&command=show&sortcondition=byTime\" target=\"aa\">"  +  CCName  +   "</a></font></b> </td></tr> ");
				}
				out.println("</table>");
				out.println("</div>");
				//rs2.close();
				//ResultSet rs3 = st.executeQuery(sql2);
				rs2.beforeFirst();
				while (rs2.next()) 
				{
					left = left + 85;
					top = top + 5;
					if(rs2.getBoolean("HasChild"))
					  showTree(con, rs2.getString("CCName"),left,top);
					
				}
			} else {
				return;
			}
		} catch (SQLException e) {
		}

	}
}

⌨️ 快捷键说明

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