- 浏览: 474210 次
- 性别:
- 来自: 南京
-
文章分类
最新评论
-
fkbld:
楼主给个密码,谢谢了,baild_zr@126.com
ExtJs direct 推送 DEMO -
文思涌动:
你的方法太好用了,感激不尽。
MyEclipse 安装ADT -
zys08:
...
jquery uploadify -
攻城使:
我现在也在学习使用Uploadfiy,摸索中
jquery uploadify -
gksrxn:
liuyulovely 写道怎么解压还要密码,楼主解压的密码是 ...
ExtJs direct 推送 DEMO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
偶的JAVA 随记
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<一>表单 提交 条件 JSP-SERVLET-JSP 获取数据库的信息 返回给控制台
1. JSP
用户的半动态表单
<%@ page language="java" pageEncoding="gbk"%>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="javax.servlet.jsp.JspWriter"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script lanaguage="javascript">
function btnQuyu_Onclick(q)
{
if(q.selectedIndex==1){
document.frm.city.style.display = "none";
document.frm.county.style.display = "none";
}
if(q.selectedIndex==2){
document.frm.city.style.display = "";
document.frm.county.style.display = "none";
}
if(q.selectedIndex==3){
document.frm.city.style.display = "";
document.frm.county.style.display = "";
}
}
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("城北供电公司","=025","=1");//county ,分组,countyID
subcat[1] = new Array("城南供电公司","=025","=2");
subcat[2] = new Array("栖霞供电公司","=025","=3");
subcat[3] = new Array("雨花供电公司","=025","=4");
subcat[4] = new Array("溧水供电公司","=025","=6");
subcat[5] = new Array("高淳供电公司","=025","=7");
subcat[6] = new Array("六合供电公司","=025","=8");
subcat[7] = new Array("浦口供电公司","=025","=9");
subcat[8] = new Array("江宁供电公司","=025","=10");
subcat[9] = new Array("计量中心","=025","=12");
subcat[10] = new Array("镇江分县1","0511","004");
subcat[11] = new Array("镇江分县2","0511","005");
subcat[12] = new Array("镇江分县3","0511","006");
onecount=13;
function changelocation(locationid)
{
document.frm.county.length = 0;
var locationid=locationid;
var i;
document.frm.county.options[0] = new Option('====所有区县====','!=0');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.frm.county.options[document.frm.county.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
</head>
<body>
<form name="frm" action="XxcxServlet" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="12"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"></td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="4" cellspacing="1">
<tr align="center" bgcolor="#EBEADB">
<td colspan="5" >详细数据查询</td>
</tr>
<tr>
<td height="14" align="left" >选择时间段:</td>
</tr>
<tr>
<td bgcolor="#f4f4f4" colspan="3">
<select name="year1">
<option>2006</option>
</select>日
</td>
</tr>
<tr bgcolor="#FFFFFF">
</tr>
<tr>
<td>
<select name="quyu" onchange="btnQuyu_Onclick(this);">
<option>==请先选择区域==</option>
<option value="aqs">按全省</option>
<option value="ads">按地市</option>
<option value="aqx">按区县</option>
</select>
</td>
</tr>
<tr bgcolor="#f4f4f4" >
<td>
<!-- 新小知识点 -->
<select name="city" onChange="changelocation(document.frm.city.options[document.frm.city.selectedIndex].value)">
<option value="!=0">==请先选择地市==</option>
<option value="=025">南京</option>
<option value="=0511">镇江</option>
<option value="=0519">常州</option>
<option value="=0516">徐州</option>
<option value="=0512">苏州</option>
<option value="=0510">无锡</option>
<option value="=0513">南通</option>
<option value="=0527">宿迁</option>
<option value="=0514">扬州</option>
<option value="=0523">泰州</option>
<option value="=0517">淮安</option>
<option value="=0515">盐城</option>
<option value="=0518">连云港</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="county">
<option>==所有区县==</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="xxcx">
<option value="!=0">==请选择业务类型==</option>
<option value="!=0">全部</option>
<option value="=1">业务受理</option>
<option value="=2">费用缴纳</option>
<option value="=3">咨询</option>
<option value="=4">查询</option>
<option value="=5">投诉举报</option>
</select>
</td>
</tr>
<tr>
<td><input type="submit" value="确定"></td>
</tr>
</table>
</form>
<script LANGUAGE="javascript">
<!--
changelocation(document.frm.city.options[document.frm.city.selectedIndex].value);
//-->
</script>
</body>
</html>
2.
获取数据库中的信息 返回 JSP
Servlet
package com.suypower.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.suypower.bean.XxcxBean;
import com.suypower.db.DBCon;
public class XxcxServlet extends HttpServlet{
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
//获取表单信息
//1。 获取表单 时间 信息
String year1=request.getParameter("year1");
String month1=request.getParameter("month1");
String day1=request.getParameter("day1");
String year2=request.getParameter("year2");
String month2=request.getParameter("month2");
String day2=request.getParameter("day2");
String time1=year1+"-"+month1+"-"+day1;
String time2=year2+"-"+month2+"-"+day2;
System.out.println("时间范围:"+time1+" and "+time2);
//2。城市ID 转换
String cityID=new String(request.getParameter("city").getBytes("iso8859-1"),"GBK");
System.out.println("城市ID:"+cityID);
//3。指标
String xxcxID=new String(request.getParameter("xxcx").getBytes("iso8859-1"),"GBK");
System.out.println("业务类型:"+xxcxID);
//4.county
String countyID=new String(request.getParameter("county").getBytes("iso8859-1"),"GBK");
//String county=request.getParameter("county");
System.out.println("地市ID:"+countyID);
//这里ywl.jsp页面上已经定义了,不用在这里转换了
//5.区域获取
String quyu=new String(request.getParameter("quyu").getBytes("iso8859-1"),"GBK");
System.out.println("选择区域是按:"+quyu);
Connection con=null;
Statement stmt=null;
HttpSession session =request.getSession();
ArrayList array=new ArrayList();
try{
con=new DBCon().getConnection();
String xxcxSQL="select city_id,operation_id,time_start,time_end,result_id2 from pj_evaluate where time_start between '"+time1+"' and '"+time2+"' and city_id"+cityID+" and county_id"+countyID+" and operation_id"+xxcxID+"";
stmt=con.createStatement();
System.out.println("sql:"+xxcxSQL);
ResultSet xxrs=stmt.executeQuery(xxcxSQL);
while(xxrs.next())
{
XxcxBean xb=new XxcxBean();
String mingcheng=xxrs.getString("city_id");
//在这里转换比较好哦
xb.setMingcheng(mingcheng);
String yewuleixing=xxrs.getString("operation_id");
xb.setYewuleixing(yewuleixing);
String pjkssj=xxrs.getString("time_start");
xb.setPjkssj(pjkssj);
String pjjssj=xxrs.getString("time_end");
xb.setPjjssj(pjjssj);
String pjjg=xxrs.getString("result_id2");
xb.setPjjg(pjjg);
array.add(xb);
}
session.setAttribute("array", array);
}catch(SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
if(con!=null)
{
con.close();
}
}catch(SQLException ee){ee.toString();}
}
//跳转到结果页面
RequestDispatcher rd=request.getRequestDispatcher("xxcx_jg.jsp");
rd.forward(request, response);
}
}
3。最终结果
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import ="java.util.ArrayList" %>
<%@ page import ="com.suypower.bean.XxcxBean" %>
<%@ taglib uri="/WEB-INF/extremecomponents" prefix="ec"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<center>
<table border="4">
<tr>
<td>名称</td><td>业务类型</td><td>评价开始时间</td><td>评价结束时间</td><td>评价结果</td>
</tr>
<tr>
<!-- 使用标签 分页显示 session 中的 信息 -->
<%
ArrayList array=new ArrayList();
array=(ArrayList)session.getAttribute("array");
%>
<%
for(int i=0;i<array.size();i++)
{
%>
<%
XxcxBean xb=new XxcxBean();
xb=(XxcxBean)array.get(i);
String mingcheng=xb.getMingcheng();
String ywlx=xb.getYewuleixing();
String startTime=xb.getPjkssj();
String endTime=xb.getPjjssj();
String suc=xb.getPjjg();
%>
<td><%= mingcheng%></td>
<td><%= ywlx%></td>
<td><%= startTime%></td>
<td><%= endTime%></td>
<td><%= suc%></td>
</tr>
<%
}
%>
</table>
</center>
</body>
</html>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<二>一个 下拉 动态 读取 数据库
FOR:
1.
package Test;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
import DBConnect.DBConn;
public class Bumen {
public void getBumen(HttpServletRequest request,JspWriter out) {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
DBConn db = new DBConn();
conn = db.getConnection();
stmt = conn.createStatement();
String sql = "select distinct bm_name from PJ_BM";
rs = stmt.executeQuery(sql);
String html ="";
while (rs.next())
{
String bm_name=rs.getString("bm_name");
out.print("<option>"+bm_name+"</option>");
}
} catch (Exception e) {
e.getMessage();
} finally {
try {
rs.close();
stmt.close();
conn.close();
} catch (Exception e) {
e.getMessage();
}
}
}
}
2.JSP
<td>
<select name="city">
<option>-请选择城市-</option>
<%
Bumen bm=new Bumen();
bm.getBumen(request,out);
%>
</select>
</td>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<三>.
一个简单的柱状报表
后台 获取 数据库的 SQL 信息 放到 SESSION
前台 显示
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="org.jfree.chart.ChartFactory,
java.awt.Color,
java.awt.Font,
org.jfree.chart.JFreeChart,
org.jfree.chart.axis.ValueAxis,
org.jfree.chart.labels.StandardCategoryItemLabelGenerator,
org.jfree.chart.plot.CategoryPlot,
org.jfree.chart.plot.PlotOrientation,
org.jfree.chart.renderer.category.*,
org.jfree.chart.servlet.ServletUtilities,
org.jfree.data.category.CategoryDataset,
org.jfree.data.category.DefaultCategoryDataset" %>
<html>
<body>
<%
String category="江苏营业厅";
double NJhushu=Double.parseDouble(session.getAttribute("NJhushu").toString());
double SZhushu=Double.parseDouble(session.getAttribute("SZhushu").toString());
double WXhushu=Double.parseDouble(session.getAttribute("WXhushu").toString());
double CZhushu=Double.parseDouble(session.getAttribute("CZhushu").toString());
double YZhushu=Double.parseDouble(session.getAttribute("YZhushu").toString());
double NThushu=Double.parseDouble(session.getAttribute("NThushu").toString());
double SQhushu=Double.parseDouble(session.getAttribute("SQhushu").toString());
double XZhushu=Double.parseDouble(session.getAttribute("XZhushu").toString());
double HAhushu=Double.parseDouble(session.getAttribute("HAhushu").toString());
double ZJhushu=Double.parseDouble(session.getAttribute("ZJhushu").toString());
double TZhushu=Double.parseDouble(session.getAttribute("TZhushu").toString());
double YChushu=Double.parseDouble(session.getAttribute("YChushu").toString());
double LYGhushu=Double.parseDouble(session.getAttribute("LYGhushu").toString());
CategoryDataset dataset=this.getDataSet(NJhushu,SZhushu,WXhushu,CZhushu,YZhushu,NThushu,SQhushu,XZhushu,HAhushu,ZJhushu,TZhushu,YChushu,LYGhushu);
String title=category+"受理户数总工号";
JFreeChart chart = ChartFactory.createBarChart3D
(
title,
"城市",
"申请户数",
dataset,
PlotOrientation.VERTICAL,
true,
false,
false
);
String filename = ServletUtilities.saveChartAsPNG(chart,750,350, null, session);
String graphURL = request.getContextPath() + "/servlet/DisplayChart?filename=" + filename;
%>
<P ALIGN="CENTER">
<img src="<%= graphURL %>" width=750 height=350 border=0 usemap="#<%= filename %>">
</P>
<%!
public static CategoryDataset getDataSet(double NJhushu,double SZhushu,double WXhushu,double CZhushu,double YZhushu,double NThushu,double SQhushu,double XZhushu,double HAhushu,double ZJhushu,double TZhushu,double YChushu,double LYGhushu)
{
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(NJhushu,"南京","南京");
dataset.addValue(SZhushu, "苏州", "苏州");
dataset.addValue(WXhushu, "无锡", "无锡");
dataset.addValue(CZhushu, "常州", "常州");
dataset.addValue(YZhushu, "扬州", "扬州");
dataset.addValue(NThushu, "南通", "南通");
dataset.addValue(SQhushu, "宿迁", "宿迁");
dataset.addValue(XZhushu, "徐州", "徐州");
dataset.addValue(HAhushu, "淮安", "淮安");
dataset.addValue(ZJhushu, "镇江", "镇江");
dataset.addValue(TZhushu, "泰州", "泰州");
dataset.addValue(YChushu, "盐城", "盐城");
dataset.addValue(LYGhushu, "连云港", "连云港");
return dataset;
}
%>
</body>
</html>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<四>.动态显示数据 导出报表 SQL 读取 到 BEAN 中 这里用的SQL是子查询 全部写入
FOR:
SQL=select a.county_id,a.county_name,
(select count(b.yw_zhh) from pj_yxyw b where b.county_id = a.county_id) as county_zhh,
(select abs(sum(cast(b.yw_rl as int))) from pj_yxyw b where b.county_id = a.county_id)as county_rl,
(select count(c.dfsf_zhh) from pj_yxdfsf c where c.county_id = a.county_id) as county_dfsf_zhh,
(select sum(cast(c.dfsf_je as decimal(35,2))) from pj_yxdfsf c where c.county_id = a.county_id)as county_dfsf_je,
(select count(d.ywsf_zhh) from pj_yxywsf d where d.county_id=a.county_id)as county_ywsf_zhh,
(select sum(cast(e.ywsf_je as decimal(35,2))) from pj_yxywsf e where e.county_id = a.county_id)as county_ywsf_je,
(select count(f.result_id) from pj_evaluate f where f.county_id=a.county_id and result_id='1') as county_my,
(select count(f.result_id) from pj_evaluate f where f.county_id=a.county_id and result_id='3') as county_bmy,
(select count(f.result_id) from pj_evaluate f where f.county_id=a.county_id and result_id='2') as county_yb,
(select count(f.result_id) from pj_evaluate f where f.county_id=a.county_id and result_id='0') as county_wpj
from pj_county a where a.city_id='"+cityID+"'
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="org.jfree.chart.ChartFactory,
java.awt.Color,
java.awt.Font,
org.jfree.chart.JFreeChart,
org.jfree.chart.axis.ValueAxis,
org.jfree.chart.labels.StandardCategoryItemLabelGenerator,
org.jfree.chart.plot.CategoryPlot,
org.jfree.chart.plot.PlotOrientation,
org.jfree.chart.renderer.category.*,
org.jfree.chart.servlet.ServletUtilities,
org.jfree.data.category.CategoryDataset,
org.jfree.data.category.DefaultCategoryDataset" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.suypower.bean.YwlBean" %>
<html>
<body>
<%
CategoryDataset dataset;
String category="营业厅";
ArrayList array=new ArrayList();
array=(ArrayList)session.getAttribute("array");
dataset=this.getDataSet(array);
String title=category+"受理总工号统计";
JFreeChart chart = ChartFactory.createBarChart3D(title,
"区县",
"受理总工号统计",
dataset,
PlotOrientation.VERTICAL,
true,
false,
false);
String filename = ServletUtilities.saveChartAsPNG(chart,750, 480, null, session);
String graphURL = request.getContextPath() + "/servlet/DisplayChart?filename=" + filename;
%>
<P ALIGN="CENTER">
<img src="<%= graphURL %>" border=0 usemap="#<%= filename %>">
</P>
<%!public static CategoryDataset getDataSet(ArrayList array)
{
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for(int i=0;i<array.size();i++)
{
YwlBean yb=(YwlBean)array.get(i);
System.out.println("城市名字"+yb.getCounty_name()+","+"户数"+yb.getCounty_zhh()+"");
dataset.addValue(Double.parseDouble(yb.getCounty_zhh().toString()),yb.getCounty_name().toString(),yb.getCounty_name().toString());
}
return dataset;
}%>
</body>
</html>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<六>
1.分页组件 extremecomponents 使用 规范 JSP 用到图片 table images 和 JAR ,TLD
<%@ page language="java" pageEncoding="gbk"%>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="javax.servlet.jsp.JspWriter"%>
<%@ taglib uri="/WEB-INF/extremecomponents" prefix="ec"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script lanaguage="javascript">
function btnQuyu_Onclick(q)
{
if(q.selectedIndex==1){
document.frm.city.style.display = "none";
document.frm.county.style.display = "none";
}
if(q.selectedIndex==2){
document.frm.city.style.display = "";
document.frm.county.style.display = "none";
}
if(q.selectedIndex==3){
document.frm.city.style.display = "";
document.frm.county.style.display = "";
}
}
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("城北供电公司","=025","=1");//county ,分组,countyID
subcat[1] = new Array("城南供电公司","=025","=2");
subcat[2] = new Array("栖霞供电公司","=025","=3");
subcat[3] = new Array("雨花供电公司","=025","=4");
subcat[4] = new Array("溧水供电公司","=025","=6");
subcat[5] = new Array("高淳供电公司","=025","=7");
subcat[6] = new Array("六合供电公司","=025","=8");
subcat[7] = new Array("浦口供电公司","=025","=9");
subcat[8] = new Array("江宁供电公司","=025","=10");
subcat[9] = new Array("计量中心","=025","=12");
subcat[10] = new Array("镇江分县1","=0511","004");
subcat[11] = new Array("镇江分县2","=0511","005");
subcat[12] = new Array("镇江分县3","=0511","006");
onecount=13;
function changelocation(locationid)
{
document.frm.county.length = 0;
var locationid=locationid;
var i;
document.frm.county.options[0] = new Option('====所有区县====','!=0');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.frm.county.options[document.frm.county.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
function showtable()
{
document.frm.change.value="change";
frm.submit();
}
</script>
</head>
<body>
<form name="frm" action="XxcxServlet" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="12"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"></td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="4" cellspacing="1">
<tr align="center" bgcolor="#EBEADB">
<td colspan="5" >详细数据查询</td>
</tr>
<tr>
<td height="14" align="left" >选择时间段:</td>
</tr>
<tr>
</select>日
</td>
</tr>
<tr bgcolor="#FFFFFF">
</tr>
<tr>
<td>
<select name="quyu" onchange="btnQuyu_Onclick(this);">
<option>==请先选择区域==</option>
<option value="aqs">按全省</option>
<option value="ads">按地市</option>
<option value="aqx">按区县</option>
</select>
</td>
</tr>
<tr bgcolor="#f4f4f4" >
<td>
<!-- 新小知识点 -->
<select name="city" onChange="changelocation(document.frm.city.options[document.frm.city.selectedIndex].value)">
<option value="!=0">==请先选择地市==</option>
<option value="=025">南京</option>
<option value="=0511">镇江</option>
<option value="=0519">常州</option>
<option value="=0516">徐州</option>
<option value="=0512">苏州</option>
<option value="=0510">无锡</option>
<option value="=0513">南通</option>
<option value="=0527">宿迁</option>
<option value="=0514">扬州</option>
<option value="=0523">泰州</option>
<option value="=0517">淮安</option>
<option value="=0515">盐城</option>
<option value="=0518">连云港</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="county">
<option>==所有区县==</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="xxcx">
<option value="!=0">==请选择业务类型==</option>
<option value="!=0">全部</option>
<option value="=1">业务受理</option>
<option value="=2">费用缴纳</option>
<option value="=3">咨询</option>
<option value="=4">查询</option>
<option value="=5">投诉举报</option>
</select>
</td>
</tr>
<tr>
<td><input type="button" value="确定" onclick="showtable()">
<input type="hidden" name="change">
</td>
</tr>
</table>
<div align="center" id="cz" >
<ec:table
action="${pageContext.request.contextPath}/XxcxServlet"
items="array"
var="a"
imagePath="${pageContext.request.contextPath}/images/table/*.gif"
width="99%"
tableId="resultTable1"
rowsDisplayed="10"
form="frm"
filterable="false"
sortable="false"
autoIncludeParameters="false">
<ec:row>
<ec:column property="mingcheng" title="【名称】" width="10%"></ec:column>
<ec:column property="yewuleixing" title="【业务类型】" width="15%"></ec:column>
<ec:column property="pjkssj" title="【评价开始时间】" width="25%"></ec:column>
<ec:column property="pjjssj" title="【评价结束时间】" width="25%"></ec:column>
<ec:column property="pjjg" title="【评价结果】" width="20%"></ec:column>
</ec:row>
</ec:table>
</div>
</form>
<script LANGUAGE="javascript">
<!--
changelocation(document.frm.city.options[document.frm.city.selectedIndex].value);
//-->
</script>
</body>
</html>
2.
SERVLET
package com.suypower.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.suypower.bean.XxcxBean;
import com.suypower.db.DBCon;
public class XxcxServlet extends HttpServlet{
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
//获取表单信息
//1。 获取表单 时间 信息
String year1=request.getParameter("year1");
String month1=request.getParameter("month1");
String day1=request.getParameter("day1");
String year2=request.getParameter("year2");
String month2=request.getParameter("month2");
String day2=request.getParameter("day2");
String time1=year1+"-"+month1+"-"+day1;
String time2=year2+"-"+month2+"-"+day2;
System.out.println("时间范围:"+time1+" and "+time2);
//2。城市ID 转换
String cityID=new String(request.getParameter("city").getBytes("iso8859-1"),"GBK");
System.out.println("城市ID:"+cityID);
//3。指标
String xxcxID=new String(request.getParameter("xxcx").getBytes("iso8859-1"),"GBK");
System.out.println("业务类型:"+xxcxID);
//4.county
String countyID=new String(request.getParameter("county").getBytes("iso8859-1"),"GBK");
//String county=request.getParameter("county");
System.out.println("地市ID:"+countyID);
//这里ywl.jsp页面上已经定义了,不用在这里转换了
//5.区域获取
//--------------------------------------------------------------------------------//
String change=request.getParameter("change");
//--------------------------------------------------------------------------------//
String quyu=new String(request.getParameter("quyu").getBytes("iso8859-1"),"GBK");
System.out.println("选择区域是按:"+quyu);
Connection con=null;
Statement stmt=null;
HttpSession session =request.getSession();
ArrayList array=new ArrayList();
if(change.equals("change"))
{
try{
con=new DBCon().getConnection();
String xxcxSQL="select city_id,operation_id,time_start,time_end,result_id2 from pj_evaluate where time_start between '"+time1+"' and '"+time2+"' and city_id"+cityID+" and county_id"+countyID+" and operation_id"+xxcxID+"";
stmt=con.createStatement();
System.out.println("sql:"+xxcxSQL);
ResultSet xxrs=stmt.executeQuery(xxcxSQL);
while(xxrs.next())
{
XxcxBean xb=new XxcxBean();
String mingcheng=xxrs.getString("city_id");
//在这里转换比较好哦
if("025".equals(mingcheng))mingcheng="南京";
if("0512".equals(mingcheng))mingcheng="苏州";
xb.setMingcheng(mingcheng);
String yewuleixing=xxrs.getString("operation_id");
if("1".equals(yewuleixing))yewuleixing="业务受理";
if("2".equals(yewuleixing))yewuleixing="费用缴纳";
if("3".equals(yewuleixing))yewuleixing="咨询";
if("4".equals(yewuleixing))yewuleixing="查询";
if("5".equals(yewuleixing))yewuleixing="投诉举报";
xb.setYewuleixing(yewuleixing);
String pjkssj=xxrs.getString("time_start");
xb.setPjkssj(pjkssj);
String pjjssj=xxrs.getString("time_end");
xb.setPjjssj(pjjssj);
String pjjg=xxrs.getString("result_id2");
if("1".equals(pjjg))pjjg="满意";
if("3".equals(pjjg))pjjg="不满意";
if("2".equals(pjjg))pjjg="一般";
if("0".equals(pjjg))pjjg="未评价";
xb.setPjjg(pjjg);
array.add(xb);
}
session.setAttribute("array", array);
}catch(SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
if(con!=null)
{
con.close();
}
}catch(SQLException ee){ee.toString();}
}
}
//跳转到结果页面
RequestDispatcher rd=request.getRequestDispatcher("xxcx.jsp");
rd.forward(request, response);
}
}
3.WEB.XML
<taglib>
<taglib-uri>/WEB-INF/extremecomponents</taglib-uri>
<taglib-location>/WEB-INF/extremecomponents.tld</taglib-location>
</taglib>
</jsp-config>
4。原始未分页 显示
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import ="java.util.ArrayList" %>
<%@ page import ="com.suypower.bean.XxcxBean" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<center>
<table border="4">
<tr>
<td>名称</td><td>业务类型</td><td>评价开始时间</td><td>评价结束时间</td><td>评价结果</td>
</tr>
<tr>
<!-- 使用标签 分页显示 session 中的 信息 -->
<%
ArrayList array=new ArrayList();
array=(ArrayList)session.getAttribute("array");
%>
<%
for(int i=0;i<array.size();i++)
{
%>
<%
XxcxBean xb=new XxcxBean();
xb=(XxcxBean)array.get(i);
String mingcheng=xb.getMingcheng();
String ywlx=xb.getYewuleixing();
String startTime=xb.getPjkssj();
String endTime=xb.getPjjssj();
String suc=xb.getPjjg();
%>
<td><%= mingcheng%></td>
<td><%= ywlx%></td>
<td><%= startTime%></td>
<td><%= endTime%></td>
<td><%= suc%></td>
</tr>
<%
}
%>
</table>
</center>
</body>
</html>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<七>
框架frameset模块 简单 代码 frameset head left right foot
1. frameset .jsp
<%@ page language="java" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>营业厅窗口服务评价系统</title>
</head>
<frameset frameborder="0" frameSpacing="0" rows="90,480,45">
<frame name="head" src="head.jsp" noResize scrolling="no" marginwidth="0" marginheight="0">
<frameset border="false" frameSpacing="0" frameBorder="0" cols="170,560">
<frame name="left" marginWidth="0" marginHeight="0" src="left.jsp" noResize scrolling="no">
<frame name="right" marginWidth="0" src="right.jsp" scrolling="auto" noResize>
</frameset>
<frame name="bottom" src="foot.jsp" noresize scrolling="no" marginwidth="0" marginheight="0">
</frameset>
</html>
2.head .jsp
<%@ page language="java" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/title01.gif" width="1009" height="100"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="8"></td>
</tr>
</table>
</body>
</html>
3.left.jsp
<%@ page language="java" pageEncoding="gb2312"%>
<html>
<body>
<head>
<meta http-equiv="refresh" content="15">
</head>
<table width="1024" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="238" height="496" valign="top" background="images/left01.gif">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="80" align="center" valign="bottom" class="a1">${qs_hs}</td>
</tr>
<tr>
<td height="80" align="center" valign="bottom"><span class="a1">${dfsf_je }</span></td>
</tr>
<tr>
<td height="75" align="center" valign="bottom"><span class="a1">${dfsf_zhh }</span></td>
</tr>
<tr>
<td height="75" align="center" valign="bottom"><span class="a1">${ywsf_zhh }</span></td>
</tr>
<tr>
<td height="70" align="center" valign="bottom"><span class="a1">${qs_rl }</span></td>
</tr>
<tr>
<td height="75" align="center" valign="bottom"><span class="a1">${ywsf_je }</span></td>
</tr>
</table></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="9" background="images/bg01.gif"></td>
</tr>
</table>
4.right .jsp
<%@ page language="java" pageEncoding="gb2312"%>
<html>
<head>
<title>内容页面</title>
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body style='OVERFLOW:SCROLL;OVERFLOW-X:HIDDEN;'>
<form name="form1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="363"></td><!-- <img src="images/login01.gif" width="777" height="480"> -->
</tr>
</table>
</form>
</body>
</html>
5.foot .jsp
<%@ page language="java" pageEncoding="gb2312"%>
<html>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/di01.gif" width="1024" height="40" border="0" usemap="#Map"></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="26,11,144,31" href="ShowCharServlet?param=ywl" target="right">
<area shape="rect" coords="277,12,381,28" href="ShowCharServlet?param=dfzj" target="right">
<area shape="rect" coords="168,11,255,30" href="ShowCharServlet?param=myd" target="right">
<area shape="rect" coords="409,11,520,32" href="ShowCharServlet?param=dfywl" target="right">
<area shape="rect" coords="552,11,648,32" href="ShowCharServlet?param=ywzj" target="right">
<area shape="rect" coords="678,10,802,31" href="ShowCharServlet?param=ywslhs" target="right">
<area shape="rect" coords="834,11,974,31" href="ShowCharServlet?param=ywslrl" target="right">
</map>
</body>
</html>
FOR:其他参考代码
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
left .jsp
<%@ page language="java" pageEncoding="gbk"%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/bg01c.gif" width="20">
</td>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/bg01d.gif" bgcolor="#f5fffa" height="34" style="width: 708px">
</td>
</tr>
<tr>
<td bgcolor="#f5fffa" valign="top" style="width: 708px">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="height: 19px">
</td>
</tr>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="90%">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="20">
<font color="#000000">
<img height="20" src="images/USER0.GIF" width="20" />
</font>
</td>
<td>
<font color="#000000"> 用户名:</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<img align="absMiddle" border="0" height="22" src="images/midminus1.gif" width="16" /><img
align="absMiddle" border="0" height="16" src="images/FOLDER01.GIF" width="16" />
<a href="###实现此功能###"><span style="color: #333333">评价数据统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/MAILBOX.GIF"
width="16" />
<a href="yeWu.do?param=yewufenbu" target="right"><span style="color: #333333">业务分布统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" src="images/LINE.GIF" /><img align="absMiddle" src="images/MIDBLK.GIF" /><img
align="absMiddle" border="0" height="16" src="images/SEND_BOX.GIF" width="16" />
<a href="MainServlet?param=manyishuju" target="right"><span style="color: #333333">满意数据分析</span></a></td>
</tr>
<tr style="color: #333333">
<td style="height: 22px">
<img align="absMiddle" src="images/LINE.GIF" /><img align="absMiddle" src="images/MIDBLK.GIF" /><img
align="absMiddle" border="0" height="16" src="images/SEARCH.GIF" width="16" />
<a href="MainServlet?param=xiangxishuju" target="right"><span style="color: #333333">详细数据查询</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" border="0" height="22" src="images/midminus1.gif" width="16" /><img
align="absMiddle" border="0" height="16" src="images/FOLDER01.GIF" width="16" />
<a href="##############"><span style="color: #333333">营销数据统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" src="images/LINE.GIF" /><img align="absMiddle" src="images/MIDBLK.GIF" /><img
align="absMiddle" border="0" height="16" src="images/TOOLS.GIF" width="16" />
<a href="MainServlet?param=yewuliang" target="right"><span style="color: #333333">业务量统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" src="images/LINE.GIF" /><img align="absMiddle" src="images/MIDBLK.GIF" /><img
align="absMiddle" border="0" height="16" src="images/TEMP_BOX.GIF" width="16" />
<a href="MainServlet?param=zijin" target="right""><span style="color: #333333">业务资金统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/SIZE.GIF"
width="16" />
<a href="MainServlet?param=dfsf" target="right""><span style="color: #333333">电费收费统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" border="0" height="22" src="images/midminus1.gif" width="16" /><img
align="absMiddle" border="0" height="16" src="images/FOLDER01.GIF" width="16" />
<a href="###########3#"><span style="color: #333333">组织机构管理</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/REFUSE.GIF"
width="16" />
<a href="yeWu.do?param=dishi" target="right""><span style="color: #333333">地市信息</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/NEW_MAIL.gif"
width="16" />
<a href="yeWu.do?param=guiyuan" target="right""><span style="color: #333333">柜员信息</span></a></td>
</tr>
<tr style="color: #333333">
<td style="height: 22px">
<img align="absMiddle" border="0" height="22" src="images/midminus1.gif" width="16" /><img
align="absMiddle" border="0" height="16" src="images/FOLDER01.GIF" width="16" />
<a href="#########3#"><span style="color: #333333">系统管理</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/take_mail.gif"
width="16" />
<a href="yeWu.do?param=yonghu" target="right""><span style="color: #333333">用户管理</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/RESUME.GIF"
width="16" />
<a href="infor.do" target="right"><span style="color: #333333">个人信息</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" border="0" height="22" src="images/LASTBLK.GIF" width="16" /><img
align="absMiddle" border="0" height="16" src="images/EXIT.GIF" width="16" />
<a href="login.jsp" target="right"><span
style="color: #333333"> 退 出</span></a></td>
</tr>
</table>
<p>
<br />
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<八>一个简单的 不安全的 login .jsp
package com.suypower.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.suypower.db.DBCon;
public class LoginServlet extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
String userid=request.getParameter("userId");
String psw=request.getParameter("userMm");
HttpSession session=request.getSession();
session.setAttribute("userid",userid);
try{
Connection con=new DBCon().getConnection();
Statement stmt=con.createStatement();
String sql1="select count(User_ID) as zongshu from PJ_User where User_ID='"+userid+"' and User_MM='"+psw+"'";
ResultSet rs1=stmt.executeQuery(sql1);
rs1.next();
String noing=rs1.getString("zongshu");
if(noing.equals("0"))
{
RequestDispatcher rd=request.getRequestDispatcher("error.jsp");
rd.forward(request, response);
}else
{
RequestDispatcher rd=request.getRequestDispatcher("frameset.jsp");
rd.forward(request, response);
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
}
FOR; 用struts + hibernate 验证用户 login .jsp
package com.suypower.struts;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import DBConnect.DBConn;
public class LoginAction extends Action
{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws Exception
{
// System.out.print("11111111111111111111");
ActionForward actionForward=new ActionForward();
// LoginForm lf=(LoginForm)form;
// String userID=lf.getUserId();
// String userMM=lf.getUserMm();
// System.out.println("222222222222222222");
// String sql="from PjUser as pj where pj.userId=:PJuserId and pj.userMm=:PJuserMm";
// //判断用户
// System.out.print("3333333333333");
// try{
// Session session=HibernateSessionFactory.getSession();
// //HibernateSessionFactory.getSession();
// //new Configuration().configure().buildSessionFactory().openSession();
// System.out.println("44444444444444");
// Transaction tx=session.beginTransaction();
// System.out.println("5555555555555555");
// Query query=session.createQuery(sql);
// System.out.println("666666666666666666");
// query.setString("PJuserId", userID);
// query.setString("PJuserMm", userMM);
// tx.commit();
// System.out.println("777777777777777777777");
// if(query.list().size()>0)
// {
// session.close();
// return mapping.findForward("frameset");
// }
// else
// {
// return mapping.findForward("error");
// }
// }catch(HibernateException e)
// {
// e.printStackTrace();
// }
// return actionForward;
String userid=request.getParameter("userId");
String psw=request.getParameter("userMm");
HttpSession session=request.getSession();
session.setAttribute("userid",userid);
Connection con=new DBConn().getConnection();
// String sql="select User_ID,User_MM,Popedom_ID from PJ_User where User_ID='"+userid+"' and User_MM='"+psw+"'";
// System.out.print(sql);
Statement stmt=con.createStatement();
// ResultSet rs=stmt.executeQuery(sql);
// while(rs.next())
// {
// String name=rs.getString("User_ID");
// String password=rs.getString("User_MM");
// String popodomID=rs.getString("Popedom_ID");
// session.setAttribute("popodomID", popodomID);
// }
String sql1="select count(User_ID) as zongshu from PJ_User where User_ID='"+userid+"' and User_MM='"+psw+"'";
ResultSet rs1=stmt.executeQuery(sql1);
rs1.next();
String noing=rs1.getString("zongshu");
System.out.println("ddddddddddddddd"+noing);
if(noing.equals("0"))
{
System.out.println("wwwwwwwwwwwww"+rs1.getRow());
return actionForward=mapping.findForward("error");
}
if(rs1.getRow()>0)
{
System.out.println("sssssssssssssss"+rs1.getRow());
return actionForward=mapping.findForward("frameset");
}
return actionForward;
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<九>: 一个地市 信息 显示 绑订到数据库 显示 连接 (联到删除 什么对应的 功能)
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="Test.SjbdDishi" %>
<html>
<body>
<div align="center">
<table>
<tr><th>统计信息:共有${count }个地市<th></tr>
</table>
<br>
<table width="75%" border=1>
<tr><th>地市</th><th>地市区号</th><th>查看</th></tr>
<%
SjbdDishi ds=new SjbdDishi();
ds.getDSsjbd(request,out);
%>
</table>
</div>
</body>
</html>
package Test;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspWriter;
import DBConnect.DBConn;
public class SjbdDishi {
public void getDSsjbd(HttpServletRequest request,JspWriter out)
{
HttpSession session=request.getSession();
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
DBConn db = new DBConn();
conn = db.getConnection();
stmt = conn.createStatement();
String sql = "select City_ID,City_NAME from dbo.PJ_City";
rs = stmt.executeQuery(sql);
while (rs.next())
{
int count=rs.getRow();
session.setAttribute("count", count);
String cityID=rs.getString("City_ID");
String cityNAME=rs.getString("City_NAME");
out.print("<tr><td>"+cityID+"</td><td>"+cityNAME+"</td>");
out.print("<td><a href=dsView.do?param="+rs.getString("City_ID")+">查看</a></td>");
}
} catch (Exception e) {
e.getMessage();
} finally {
try {
rs.close();
stmt.close();
conn.close();
} catch (Exception e) {
}
}
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
jdbc 连接
package com.suypower.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DBCon {
final private String driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver";
final private String driverURL="jdbc:sqlserver://172.23.23.3:1433;databaseName=pjtest";
final private String username="pj";
final private String password="pj3023";
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
public Connection getConnection()
{
try
{
Class.forName(driverName);
}catch(ClassNotFoundException e)
{
System.out.println("%%%连接驱动失败%%%");
e.printStackTrace();
}
try
{
con=DriverManager.getConnection(driverURL,username,password);
}catch(SQLException e)
{
e.printStackTrace();
System.out.println("%%%连接数据库失败%%%");
}
finally
{
}
return con;
}
}
%%%%%%%%%%%%%%%%%%%%%%-2007-12-18-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
extremeComponents 的删除 和编辑弹出页面 实现
1。分页信息输出
<div align="center" id="cz" >
<ec:table
action="${pageContext.request.contextPath}/BmServlet"
items="arrayBM"
var="a"
imagePath="${pageContext.request.contextPath}/images/table/*.gif"
width="99%"
tableId="resultTable1"
rowsDisplayed="10"
form="frm"
filterable="false"
sortable="false"
autoIncludeParameters="false">
<ec:row>
<ec:column property="city_id" title="【所属地市】" width="16%"></ec:column>
<ec:column property="county_id" title="【分县公司】" width="16%"></ec:column>
<ec:column property="bm_id" title="【所属部门】" width="16%"></ec:column>
<ec:column property="person_id" title="【员工工号】" width="16%"></ec:column>
<ec:column property="person_name" title="【员工姓名】" width="16%"></ec:column>
<ec:column property="【编辑】" title="" width="10%">
<input type="button" value="编辑" name="space">
</ec:column>
<ec:column property="【删除】" title="" width="10%">
<input type="button" value="删除" onclick="del('${a.person_id }')">
</ec:column>
</ec:row>
</ec:table>
<input type="hidden" name="shanchu">
</div>
2。
。。。。
。。。
function del(person_id)
{
document.frm.change.value="shanchu";
document.frm.shanchu.value=person_id;
frm.submit();
}
</script>
3。servlet 获取参数 然后 连接数据库 执行删除
。。。
。。。。
if(param.equals("shanchu"))
{
String person_id=request.getParameter("shanchu");
//写SQL语句 删除
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
System.out.println(person_id);
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
编辑
思路:用分页组件 extremecomponents 实现 编辑
然后 传参数
用JS实现 弹出页面
页面上是用JSP
然后用的是 JS限制格式
JSP action=到 SERVLET
SERVLET 获取 参数
连接数据库 update 数据 即可
很清晰的思路哦
代码:
<div align="center" id="cz" >
<ec:table
action="${pageContext.request.contextPath}/BmServlet"
items="arrayBM"
var="a"
imagePath="${pageContext.request.contextPath}/images/table/*.gif"
width="99%"
tableId="resultTable1"
rowsDisplayed="10"
form="frm"
filterable="false"
sortable="false"
autoIncludeParameters="false">
<ec:row>
<ec:column property="city_id" title="【所属地市】" width="16%"></ec:column>
<ec:column property="county_id" title="【分县公司】" width="16%"></ec:column>
<ec:column property="bm_id" title="【所属部门】" width="16%"></ec:column>
<ec:column property="person_id" title="【员工工号】" width="16%"></ec:column>
<ec:column property="person_name" title="【员工姓名】" width="16%"></ec:column>
<ec:column property="【编辑】" title="" width="10%">
<input type="button" value="编辑" onclick="edit('${a.person_id }','${a.city_id }','${a.county_id }','${a.bm_id }','${a.person_name }')" >
</ec:column>
<ec:column property="【删除】" title="" width="10%">
<input type="button" value="删除" onclick="del('${a.person_id }')">
</ec:column>
</ec:row>
</ec:table>
<input type="hidden" name="shanchu">
</div>
....
...
function edit(person_id,city_id,county_id,bm_id,person_name)
{
url="edit.jsp?personid="+person_id+"&cityid="+city_id+"&countyid="+county_id+"&bmid="+bm_id+"&personName="+person_name;
//alert(url);
window.open(url,'newwindow','height=250,width=400,top=200,left=200,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
}
</script>
JSP
<%@ page language="java" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<%
String personid=new String(request.getParameter("personid").getBytes("iso8859-1"),"gbk");
String cityid=new String(request.getParameter("cityid").getBytes("iso8859-1"),"gbk");
String countyid=new String(request.getParameter("countyid").getBytes("iso8859-1"),"gbk");
String bmid=new String(request.getParameter("bmid").getBytes("iso8859-1"),"gbk");
String personName=new String(request.getParameter("personName").getBytes("iso8859-1"),"gbk");
%>
<form action="EditServlet" method="post">
<table>
<tr><td>用户ID:</td><td><%= personid %></td></tr>
<tr><td>用户名:</td><td><%= personName %></td></tr>
<tr><td>城市:</td><td><%= cityid %></td></tr>
<tr><td>区县:</td><td><input type="text" value="<%= countyid %>" name="aaa"></td></tr>
<tr><td>部门:</td><td><input type="text" value="<%= bmid %>" name="bbb"></td></tr>
<tr>
<td>是否为服务人员:</td>
<td>
<select name="fuwu">
<option>是</option>
<option>否</option>
</select>
</td></tr>
<tr><td><input type="submit" value="确定"></td></tr>
</table>
</form>
</body>
</html>
Servlet
。。。。。。。。。
获取表单信息 写SQL 更新 即可 很简单的 这里就不给代码了
//////////////////////////////////////////////////2007-12-19//////////////////////////////////////////////////////////。。。。。。。。。。。。。。。AJAX 联动。。。。。。。。。。。。。。。
ajax
<%@ page language="java" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
This is my ajax JSP page. <br>
<head>
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
if(window.ActionXObject)
{
xmlHttp=new ActionXObject("Microsoft.XMLHTTP");
}
elst if(window.XMLHttpRequest)
{
xmlHttp=new XMLHttpRequest();
}
function startRequest()
{
createXMLHttpRequest();
xmlHttp.onreadystatechange=handleStateChange;
xmlRequest.open("get","innerHTML",true);
xmlHttp.send(null);
}
function handleStateChange()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
document.getElementById("results").innerHTML=xmlHttp.responseText;
}
}
}
}
</script>
</head>
<body>
<form action="#">
<input type="button" value="ajax" onclick="startRequest();"/>
<div id="results"></div>
</form>
</body>
</html>
innerHTML.xml
...
.....
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ajax 实现级联下拉 更新 数据库
<head>
<script language ="javascript">
var http_request = false;
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{ //IE浏览器
http_request=new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}
function Change_Select(){
var cityID=document.frm.city.value;
createXMLHttpRequest();
http_request.onreadystatechange=callback;
http_request.open("get","TestServlet?cityid="+cityID,true);
http_request.send(null);
}
function callback(){
if(http_request.readyState == 4)
{
if(http_request.status == 200)
{
var str=http_request.responseText;
if(str!=null)
{
var field=str.split("|");
}
document.getElementById("county").length=0;//调用之前先置为空
for(var i=0;i<field.length-1;i++)
{
var option=field[i].split(",");
document.frm.county.add(new Option(option[0],option[0]));
}
}else {
alert("http_request.status == 200 失败");
}
}
}
</script>
</head>
<body>
<form name="frm" action="YwlServlet" method="post">
.......................
<select name="city" onChange="Change_Select()">
<option>==请先选择地市==</option>
<option value="025">南京</option>
<option value="0511">镇江</option>
<option value="0519">常州</option>
....................
.................
...
<td>
<select name="county">
<option>==所有区县==</option>
</select>
</td>
..............
servlet
...
..
package com.suypower.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.suypower.db.DBCon;
public class TestServlet extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("gb2312");
response.setContentType("text/html");
response.setCharacterEncoding("gb2312");
doPost(request,response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
//String cityID=request.getParameter("cityid");
Connection con=null;
Statement stmt=null;
PrintWriter out=response.getWriter();
request.setCharacterEncoding("gb2312");
response.setContentType("text/html");
response.setCharacterEncoding("gb2312");
try{
con=new com.suypower.db.DBCon().getConnection();
stmt=con.createStatement();
String sql="select county_name from pj_county";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next())
{
String county_name=rs.getString("county_name");
out.print(county_name+"|");
}
}catch(SQLException e){e.printStackTrace();}
}
}
¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥
程雨__级联菜单__树型结构
不要着急 我们 来 先看看API
Overview
Functions
add
openAll
closeAll
openTo
Configuration
Functions
add()
Adds a node to the tree.
Can only be called before the tree is drawn.
id, pid and name are required.
Parameters
Name Type Description
id Number Unique identity number.
pid Number Number refering to the parent node. The value for the root node has to be -1.
name String Text label for the node.
url String
偶的JAVA 随记
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<一>表单 提交 条件 JSP-SERVLET-JSP 获取数据库的信息 返回给控制台
1. JSP
用户的半动态表单
<%@ page language="java" pageEncoding="gbk"%>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="javax.servlet.jsp.JspWriter"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script lanaguage="javascript">
function btnQuyu_Onclick(q)
{
if(q.selectedIndex==1){
document.frm.city.style.display = "none";
document.frm.county.style.display = "none";
}
if(q.selectedIndex==2){
document.frm.city.style.display = "";
document.frm.county.style.display = "none";
}
if(q.selectedIndex==3){
document.frm.city.style.display = "";
document.frm.county.style.display = "";
}
}
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("城北供电公司","=025","=1");//county ,分组,countyID
subcat[1] = new Array("城南供电公司","=025","=2");
subcat[2] = new Array("栖霞供电公司","=025","=3");
subcat[3] = new Array("雨花供电公司","=025","=4");
subcat[4] = new Array("溧水供电公司","=025","=6");
subcat[5] = new Array("高淳供电公司","=025","=7");
subcat[6] = new Array("六合供电公司","=025","=8");
subcat[7] = new Array("浦口供电公司","=025","=9");
subcat[8] = new Array("江宁供电公司","=025","=10");
subcat[9] = new Array("计量中心","=025","=12");
subcat[10] = new Array("镇江分县1","0511","004");
subcat[11] = new Array("镇江分县2","0511","005");
subcat[12] = new Array("镇江分县3","0511","006");
onecount=13;
function changelocation(locationid)
{
document.frm.county.length = 0;
var locationid=locationid;
var i;
document.frm.county.options[0] = new Option('====所有区县====','!=0');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.frm.county.options[document.frm.county.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
</head>
<body>
<form name="frm" action="XxcxServlet" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="12"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"></td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="4" cellspacing="1">
<tr align="center" bgcolor="#EBEADB">
<td colspan="5" >详细数据查询</td>
</tr>
<tr>
<td height="14" align="left" >选择时间段:</td>
</tr>
<tr>
<td bgcolor="#f4f4f4" colspan="3">
<select name="year1">
<option>2006</option>
</select>日
</td>
</tr>
<tr bgcolor="#FFFFFF">
</tr>
<tr>
<td>
<select name="quyu" onchange="btnQuyu_Onclick(this);">
<option>==请先选择区域==</option>
<option value="aqs">按全省</option>
<option value="ads">按地市</option>
<option value="aqx">按区县</option>
</select>
</td>
</tr>
<tr bgcolor="#f4f4f4" >
<td>
<!-- 新小知识点 -->
<select name="city" onChange="changelocation(document.frm.city.options[document.frm.city.selectedIndex].value)">
<option value="!=0">==请先选择地市==</option>
<option value="=025">南京</option>
<option value="=0511">镇江</option>
<option value="=0519">常州</option>
<option value="=0516">徐州</option>
<option value="=0512">苏州</option>
<option value="=0510">无锡</option>
<option value="=0513">南通</option>
<option value="=0527">宿迁</option>
<option value="=0514">扬州</option>
<option value="=0523">泰州</option>
<option value="=0517">淮安</option>
<option value="=0515">盐城</option>
<option value="=0518">连云港</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="county">
<option>==所有区县==</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="xxcx">
<option value="!=0">==请选择业务类型==</option>
<option value="!=0">全部</option>
<option value="=1">业务受理</option>
<option value="=2">费用缴纳</option>
<option value="=3">咨询</option>
<option value="=4">查询</option>
<option value="=5">投诉举报</option>
</select>
</td>
</tr>
<tr>
<td><input type="submit" value="确定"></td>
</tr>
</table>
</form>
<script LANGUAGE="javascript">
<!--
changelocation(document.frm.city.options[document.frm.city.selectedIndex].value);
//-->
</script>
</body>
</html>
2.
获取数据库中的信息 返回 JSP
Servlet
package com.suypower.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.suypower.bean.XxcxBean;
import com.suypower.db.DBCon;
public class XxcxServlet extends HttpServlet{
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
//获取表单信息
//1。 获取表单 时间 信息
String year1=request.getParameter("year1");
String month1=request.getParameter("month1");
String day1=request.getParameter("day1");
String year2=request.getParameter("year2");
String month2=request.getParameter("month2");
String day2=request.getParameter("day2");
String time1=year1+"-"+month1+"-"+day1;
String time2=year2+"-"+month2+"-"+day2;
System.out.println("时间范围:"+time1+" and "+time2);
//2。城市ID 转换
String cityID=new String(request.getParameter("city").getBytes("iso8859-1"),"GBK");
System.out.println("城市ID:"+cityID);
//3。指标
String xxcxID=new String(request.getParameter("xxcx").getBytes("iso8859-1"),"GBK");
System.out.println("业务类型:"+xxcxID);
//4.county
String countyID=new String(request.getParameter("county").getBytes("iso8859-1"),"GBK");
//String county=request.getParameter("county");
System.out.println("地市ID:"+countyID);
//这里ywl.jsp页面上已经定义了,不用在这里转换了
//5.区域获取
String quyu=new String(request.getParameter("quyu").getBytes("iso8859-1"),"GBK");
System.out.println("选择区域是按:"+quyu);
Connection con=null;
Statement stmt=null;
HttpSession session =request.getSession();
ArrayList array=new ArrayList();
try{
con=new DBCon().getConnection();
String xxcxSQL="select city_id,operation_id,time_start,time_end,result_id2 from pj_evaluate where time_start between '"+time1+"' and '"+time2+"' and city_id"+cityID+" and county_id"+countyID+" and operation_id"+xxcxID+"";
stmt=con.createStatement();
System.out.println("sql:"+xxcxSQL);
ResultSet xxrs=stmt.executeQuery(xxcxSQL);
while(xxrs.next())
{
XxcxBean xb=new XxcxBean();
String mingcheng=xxrs.getString("city_id");
//在这里转换比较好哦
xb.setMingcheng(mingcheng);
String yewuleixing=xxrs.getString("operation_id");
xb.setYewuleixing(yewuleixing);
String pjkssj=xxrs.getString("time_start");
xb.setPjkssj(pjkssj);
String pjjssj=xxrs.getString("time_end");
xb.setPjjssj(pjjssj);
String pjjg=xxrs.getString("result_id2");
xb.setPjjg(pjjg);
array.add(xb);
}
session.setAttribute("array", array);
}catch(SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
if(con!=null)
{
con.close();
}
}catch(SQLException ee){ee.toString();}
}
//跳转到结果页面
RequestDispatcher rd=request.getRequestDispatcher("xxcx_jg.jsp");
rd.forward(request, response);
}
}
3。最终结果
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import ="java.util.ArrayList" %>
<%@ page import ="com.suypower.bean.XxcxBean" %>
<%@ taglib uri="/WEB-INF/extremecomponents" prefix="ec"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<center>
<table border="4">
<tr>
<td>名称</td><td>业务类型</td><td>评价开始时间</td><td>评价结束时间</td><td>评价结果</td>
</tr>
<tr>
<!-- 使用标签 分页显示 session 中的 信息 -->
<%
ArrayList array=new ArrayList();
array=(ArrayList)session.getAttribute("array");
%>
<%
for(int i=0;i<array.size();i++)
{
%>
<%
XxcxBean xb=new XxcxBean();
xb=(XxcxBean)array.get(i);
String mingcheng=xb.getMingcheng();
String ywlx=xb.getYewuleixing();
String startTime=xb.getPjkssj();
String endTime=xb.getPjjssj();
String suc=xb.getPjjg();
%>
<td><%= mingcheng%></td>
<td><%= ywlx%></td>
<td><%= startTime%></td>
<td><%= endTime%></td>
<td><%= suc%></td>
</tr>
<%
}
%>
</table>
</center>
</body>
</html>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<二>一个 下拉 动态 读取 数据库
FOR:
1.
package Test;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
import DBConnect.DBConn;
public class Bumen {
public void getBumen(HttpServletRequest request,JspWriter out) {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
DBConn db = new DBConn();
conn = db.getConnection();
stmt = conn.createStatement();
String sql = "select distinct bm_name from PJ_BM";
rs = stmt.executeQuery(sql);
String html ="";
while (rs.next())
{
String bm_name=rs.getString("bm_name");
out.print("<option>"+bm_name+"</option>");
}
} catch (Exception e) {
e.getMessage();
} finally {
try {
rs.close();
stmt.close();
conn.close();
} catch (Exception e) {
e.getMessage();
}
}
}
}
2.JSP
<td>
<select name="city">
<option>-请选择城市-</option>
<%
Bumen bm=new Bumen();
bm.getBumen(request,out);
%>
</select>
</td>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<三>.
一个简单的柱状报表
后台 获取 数据库的 SQL 信息 放到 SESSION
前台 显示
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="org.jfree.chart.ChartFactory,
java.awt.Color,
java.awt.Font,
org.jfree.chart.JFreeChart,
org.jfree.chart.axis.ValueAxis,
org.jfree.chart.labels.StandardCategoryItemLabelGenerator,
org.jfree.chart.plot.CategoryPlot,
org.jfree.chart.plot.PlotOrientation,
org.jfree.chart.renderer.category.*,
org.jfree.chart.servlet.ServletUtilities,
org.jfree.data.category.CategoryDataset,
org.jfree.data.category.DefaultCategoryDataset" %>
<html>
<body>
<%
String category="江苏营业厅";
double NJhushu=Double.parseDouble(session.getAttribute("NJhushu").toString());
double SZhushu=Double.parseDouble(session.getAttribute("SZhushu").toString());
double WXhushu=Double.parseDouble(session.getAttribute("WXhushu").toString());
double CZhushu=Double.parseDouble(session.getAttribute("CZhushu").toString());
double YZhushu=Double.parseDouble(session.getAttribute("YZhushu").toString());
double NThushu=Double.parseDouble(session.getAttribute("NThushu").toString());
double SQhushu=Double.parseDouble(session.getAttribute("SQhushu").toString());
double XZhushu=Double.parseDouble(session.getAttribute("XZhushu").toString());
double HAhushu=Double.parseDouble(session.getAttribute("HAhushu").toString());
double ZJhushu=Double.parseDouble(session.getAttribute("ZJhushu").toString());
double TZhushu=Double.parseDouble(session.getAttribute("TZhushu").toString());
double YChushu=Double.parseDouble(session.getAttribute("YChushu").toString());
double LYGhushu=Double.parseDouble(session.getAttribute("LYGhushu").toString());
CategoryDataset dataset=this.getDataSet(NJhushu,SZhushu,WXhushu,CZhushu,YZhushu,NThushu,SQhushu,XZhushu,HAhushu,ZJhushu,TZhushu,YChushu,LYGhushu);
String title=category+"受理户数总工号";
JFreeChart chart = ChartFactory.createBarChart3D
(
title,
"城市",
"申请户数",
dataset,
PlotOrientation.VERTICAL,
true,
false,
false
);
String filename = ServletUtilities.saveChartAsPNG(chart,750,350, null, session);
String graphURL = request.getContextPath() + "/servlet/DisplayChart?filename=" + filename;
%>
<P ALIGN="CENTER">
<img src="<%= graphURL %>" width=750 height=350 border=0 usemap="#<%= filename %>">
</P>
<%!
public static CategoryDataset getDataSet(double NJhushu,double SZhushu,double WXhushu,double CZhushu,double YZhushu,double NThushu,double SQhushu,double XZhushu,double HAhushu,double ZJhushu,double TZhushu,double YChushu,double LYGhushu)
{
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(NJhushu,"南京","南京");
dataset.addValue(SZhushu, "苏州", "苏州");
dataset.addValue(WXhushu, "无锡", "无锡");
dataset.addValue(CZhushu, "常州", "常州");
dataset.addValue(YZhushu, "扬州", "扬州");
dataset.addValue(NThushu, "南通", "南通");
dataset.addValue(SQhushu, "宿迁", "宿迁");
dataset.addValue(XZhushu, "徐州", "徐州");
dataset.addValue(HAhushu, "淮安", "淮安");
dataset.addValue(ZJhushu, "镇江", "镇江");
dataset.addValue(TZhushu, "泰州", "泰州");
dataset.addValue(YChushu, "盐城", "盐城");
dataset.addValue(LYGhushu, "连云港", "连云港");
return dataset;
}
%>
</body>
</html>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<四>.动态显示数据 导出报表 SQL 读取 到 BEAN 中 这里用的SQL是子查询 全部写入
FOR:
SQL=select a.county_id,a.county_name,
(select count(b.yw_zhh) from pj_yxyw b where b.county_id = a.county_id) as county_zhh,
(select abs(sum(cast(b.yw_rl as int))) from pj_yxyw b where b.county_id = a.county_id)as county_rl,
(select count(c.dfsf_zhh) from pj_yxdfsf c where c.county_id = a.county_id) as county_dfsf_zhh,
(select sum(cast(c.dfsf_je as decimal(35,2))) from pj_yxdfsf c where c.county_id = a.county_id)as county_dfsf_je,
(select count(d.ywsf_zhh) from pj_yxywsf d where d.county_id=a.county_id)as county_ywsf_zhh,
(select sum(cast(e.ywsf_je as decimal(35,2))) from pj_yxywsf e where e.county_id = a.county_id)as county_ywsf_je,
(select count(f.result_id) from pj_evaluate f where f.county_id=a.county_id and result_id='1') as county_my,
(select count(f.result_id) from pj_evaluate f where f.county_id=a.county_id and result_id='3') as county_bmy,
(select count(f.result_id) from pj_evaluate f where f.county_id=a.county_id and result_id='2') as county_yb,
(select count(f.result_id) from pj_evaluate f where f.county_id=a.county_id and result_id='0') as county_wpj
from pj_county a where a.city_id='"+cityID+"'
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="org.jfree.chart.ChartFactory,
java.awt.Color,
java.awt.Font,
org.jfree.chart.JFreeChart,
org.jfree.chart.axis.ValueAxis,
org.jfree.chart.labels.StandardCategoryItemLabelGenerator,
org.jfree.chart.plot.CategoryPlot,
org.jfree.chart.plot.PlotOrientation,
org.jfree.chart.renderer.category.*,
org.jfree.chart.servlet.ServletUtilities,
org.jfree.data.category.CategoryDataset,
org.jfree.data.category.DefaultCategoryDataset" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.suypower.bean.YwlBean" %>
<html>
<body>
<%
CategoryDataset dataset;
String category="营业厅";
ArrayList array=new ArrayList();
array=(ArrayList)session.getAttribute("array");
dataset=this.getDataSet(array);
String title=category+"受理总工号统计";
JFreeChart chart = ChartFactory.createBarChart3D(title,
"区县",
"受理总工号统计",
dataset,
PlotOrientation.VERTICAL,
true,
false,
false);
String filename = ServletUtilities.saveChartAsPNG(chart,750, 480, null, session);
String graphURL = request.getContextPath() + "/servlet/DisplayChart?filename=" + filename;
%>
<P ALIGN="CENTER">
<img src="<%= graphURL %>" border=0 usemap="#<%= filename %>">
</P>
<%!public static CategoryDataset getDataSet(ArrayList array)
{
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for(int i=0;i<array.size();i++)
{
YwlBean yb=(YwlBean)array.get(i);
System.out.println("城市名字"+yb.getCounty_name()+","+"户数"+yb.getCounty_zhh()+"");
dataset.addValue(Double.parseDouble(yb.getCounty_zhh().toString()),yb.getCounty_name().toString(),yb.getCounty_name().toString());
}
return dataset;
}%>
</body>
</html>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<六>
1.分页组件 extremecomponents 使用 规范 JSP 用到图片 table images 和 JAR ,TLD
<%@ page language="java" pageEncoding="gbk"%>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="javax.servlet.jsp.JspWriter"%>
<%@ taglib uri="/WEB-INF/extremecomponents" prefix="ec"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script lanaguage="javascript">
function btnQuyu_Onclick(q)
{
if(q.selectedIndex==1){
document.frm.city.style.display = "none";
document.frm.county.style.display = "none";
}
if(q.selectedIndex==2){
document.frm.city.style.display = "";
document.frm.county.style.display = "none";
}
if(q.selectedIndex==3){
document.frm.city.style.display = "";
document.frm.county.style.display = "";
}
}
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("城北供电公司","=025","=1");//county ,分组,countyID
subcat[1] = new Array("城南供电公司","=025","=2");
subcat[2] = new Array("栖霞供电公司","=025","=3");
subcat[3] = new Array("雨花供电公司","=025","=4");
subcat[4] = new Array("溧水供电公司","=025","=6");
subcat[5] = new Array("高淳供电公司","=025","=7");
subcat[6] = new Array("六合供电公司","=025","=8");
subcat[7] = new Array("浦口供电公司","=025","=9");
subcat[8] = new Array("江宁供电公司","=025","=10");
subcat[9] = new Array("计量中心","=025","=12");
subcat[10] = new Array("镇江分县1","=0511","004");
subcat[11] = new Array("镇江分县2","=0511","005");
subcat[12] = new Array("镇江分县3","=0511","006");
onecount=13;
function changelocation(locationid)
{
document.frm.county.length = 0;
var locationid=locationid;
var i;
document.frm.county.options[0] = new Option('====所有区县====','!=0');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.frm.county.options[document.frm.county.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
function showtable()
{
document.frm.change.value="change";
frm.submit();
}
</script>
</head>
<body>
<form name="frm" action="XxcxServlet" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="12"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6"></td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="4" cellspacing="1">
<tr align="center" bgcolor="#EBEADB">
<td colspan="5" >详细数据查询</td>
</tr>
<tr>
<td height="14" align="left" >选择时间段:</td>
</tr>
<tr>
</select>日
</td>
</tr>
<tr bgcolor="#FFFFFF">
</tr>
<tr>
<td>
<select name="quyu" onchange="btnQuyu_Onclick(this);">
<option>==请先选择区域==</option>
<option value="aqs">按全省</option>
<option value="ads">按地市</option>
<option value="aqx">按区县</option>
</select>
</td>
</tr>
<tr bgcolor="#f4f4f4" >
<td>
<!-- 新小知识点 -->
<select name="city" onChange="changelocation(document.frm.city.options[document.frm.city.selectedIndex].value)">
<option value="!=0">==请先选择地市==</option>
<option value="=025">南京</option>
<option value="=0511">镇江</option>
<option value="=0519">常州</option>
<option value="=0516">徐州</option>
<option value="=0512">苏州</option>
<option value="=0510">无锡</option>
<option value="=0513">南通</option>
<option value="=0527">宿迁</option>
<option value="=0514">扬州</option>
<option value="=0523">泰州</option>
<option value="=0517">淮安</option>
<option value="=0515">盐城</option>
<option value="=0518">连云港</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="county">
<option>==所有区县==</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="xxcx">
<option value="!=0">==请选择业务类型==</option>
<option value="!=0">全部</option>
<option value="=1">业务受理</option>
<option value="=2">费用缴纳</option>
<option value="=3">咨询</option>
<option value="=4">查询</option>
<option value="=5">投诉举报</option>
</select>
</td>
</tr>
<tr>
<td><input type="button" value="确定" onclick="showtable()">
<input type="hidden" name="change">
</td>
</tr>
</table>
<div align="center" id="cz" >
<ec:table
action="${pageContext.request.contextPath}/XxcxServlet"
items="array"
var="a"
imagePath="${pageContext.request.contextPath}/images/table/*.gif"
width="99%"
tableId="resultTable1"
rowsDisplayed="10"
form="frm"
filterable="false"
sortable="false"
autoIncludeParameters="false">
<ec:row>
<ec:column property="mingcheng" title="【名称】" width="10%"></ec:column>
<ec:column property="yewuleixing" title="【业务类型】" width="15%"></ec:column>
<ec:column property="pjkssj" title="【评价开始时间】" width="25%"></ec:column>
<ec:column property="pjjssj" title="【评价结束时间】" width="25%"></ec:column>
<ec:column property="pjjg" title="【评价结果】" width="20%"></ec:column>
</ec:row>
</ec:table>
</div>
</form>
<script LANGUAGE="javascript">
<!--
changelocation(document.frm.city.options[document.frm.city.selectedIndex].value);
//-->
</script>
</body>
</html>
2.
SERVLET
package com.suypower.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.suypower.bean.XxcxBean;
import com.suypower.db.DBCon;
public class XxcxServlet extends HttpServlet{
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
//获取表单信息
//1。 获取表单 时间 信息
String year1=request.getParameter("year1");
String month1=request.getParameter("month1");
String day1=request.getParameter("day1");
String year2=request.getParameter("year2");
String month2=request.getParameter("month2");
String day2=request.getParameter("day2");
String time1=year1+"-"+month1+"-"+day1;
String time2=year2+"-"+month2+"-"+day2;
System.out.println("时间范围:"+time1+" and "+time2);
//2。城市ID 转换
String cityID=new String(request.getParameter("city").getBytes("iso8859-1"),"GBK");
System.out.println("城市ID:"+cityID);
//3。指标
String xxcxID=new String(request.getParameter("xxcx").getBytes("iso8859-1"),"GBK");
System.out.println("业务类型:"+xxcxID);
//4.county
String countyID=new String(request.getParameter("county").getBytes("iso8859-1"),"GBK");
//String county=request.getParameter("county");
System.out.println("地市ID:"+countyID);
//这里ywl.jsp页面上已经定义了,不用在这里转换了
//5.区域获取
//--------------------------------------------------------------------------------//
String change=request.getParameter("change");
//--------------------------------------------------------------------------------//
String quyu=new String(request.getParameter("quyu").getBytes("iso8859-1"),"GBK");
System.out.println("选择区域是按:"+quyu);
Connection con=null;
Statement stmt=null;
HttpSession session =request.getSession();
ArrayList array=new ArrayList();
if(change.equals("change"))
{
try{
con=new DBCon().getConnection();
String xxcxSQL="select city_id,operation_id,time_start,time_end,result_id2 from pj_evaluate where time_start between '"+time1+"' and '"+time2+"' and city_id"+cityID+" and county_id"+countyID+" and operation_id"+xxcxID+"";
stmt=con.createStatement();
System.out.println("sql:"+xxcxSQL);
ResultSet xxrs=stmt.executeQuery(xxcxSQL);
while(xxrs.next())
{
XxcxBean xb=new XxcxBean();
String mingcheng=xxrs.getString("city_id");
//在这里转换比较好哦
if("025".equals(mingcheng))mingcheng="南京";
if("0512".equals(mingcheng))mingcheng="苏州";
xb.setMingcheng(mingcheng);
String yewuleixing=xxrs.getString("operation_id");
if("1".equals(yewuleixing))yewuleixing="业务受理";
if("2".equals(yewuleixing))yewuleixing="费用缴纳";
if("3".equals(yewuleixing))yewuleixing="咨询";
if("4".equals(yewuleixing))yewuleixing="查询";
if("5".equals(yewuleixing))yewuleixing="投诉举报";
xb.setYewuleixing(yewuleixing);
String pjkssj=xxrs.getString("time_start");
xb.setPjkssj(pjkssj);
String pjjssj=xxrs.getString("time_end");
xb.setPjjssj(pjjssj);
String pjjg=xxrs.getString("result_id2");
if("1".equals(pjjg))pjjg="满意";
if("3".equals(pjjg))pjjg="不满意";
if("2".equals(pjjg))pjjg="一般";
if("0".equals(pjjg))pjjg="未评价";
xb.setPjjg(pjjg);
array.add(xb);
}
session.setAttribute("array", array);
}catch(SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
if(con!=null)
{
con.close();
}
}catch(SQLException ee){ee.toString();}
}
}
//跳转到结果页面
RequestDispatcher rd=request.getRequestDispatcher("xxcx.jsp");
rd.forward(request, response);
}
}
3.WEB.XML
<taglib>
<taglib-uri>/WEB-INF/extremecomponents</taglib-uri>
<taglib-location>/WEB-INF/extremecomponents.tld</taglib-location>
</taglib>
</jsp-config>
4。原始未分页 显示
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import ="java.util.ArrayList" %>
<%@ page import ="com.suypower.bean.XxcxBean" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<center>
<table border="4">
<tr>
<td>名称</td><td>业务类型</td><td>评价开始时间</td><td>评价结束时间</td><td>评价结果</td>
</tr>
<tr>
<!-- 使用标签 分页显示 session 中的 信息 -->
<%
ArrayList array=new ArrayList();
array=(ArrayList)session.getAttribute("array");
%>
<%
for(int i=0;i<array.size();i++)
{
%>
<%
XxcxBean xb=new XxcxBean();
xb=(XxcxBean)array.get(i);
String mingcheng=xb.getMingcheng();
String ywlx=xb.getYewuleixing();
String startTime=xb.getPjkssj();
String endTime=xb.getPjjssj();
String suc=xb.getPjjg();
%>
<td><%= mingcheng%></td>
<td><%= ywlx%></td>
<td><%= startTime%></td>
<td><%= endTime%></td>
<td><%= suc%></td>
</tr>
<%
}
%>
</table>
</center>
</body>
</html>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<七>
框架frameset模块 简单 代码 frameset head left right foot
1. frameset .jsp
<%@ page language="java" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>营业厅窗口服务评价系统</title>
</head>
<frameset frameborder="0" frameSpacing="0" rows="90,480,45">
<frame name="head" src="head.jsp" noResize scrolling="no" marginwidth="0" marginheight="0">
<frameset border="false" frameSpacing="0" frameBorder="0" cols="170,560">
<frame name="left" marginWidth="0" marginHeight="0" src="left.jsp" noResize scrolling="no">
<frame name="right" marginWidth="0" src="right.jsp" scrolling="auto" noResize>
</frameset>
<frame name="bottom" src="foot.jsp" noresize scrolling="no" marginwidth="0" marginheight="0">
</frameset>
</html>
2.head .jsp
<%@ page language="java" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/title01.gif" width="1009" height="100"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="8"></td>
</tr>
</table>
</body>
</html>
3.left.jsp
<%@ page language="java" pageEncoding="gb2312"%>
<html>
<body>
<head>
<meta http-equiv="refresh" content="15">
</head>
<table width="1024" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="238" height="496" valign="top" background="images/left01.gif">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="80" align="center" valign="bottom" class="a1">${qs_hs}</td>
</tr>
<tr>
<td height="80" align="center" valign="bottom"><span class="a1">${dfsf_je }</span></td>
</tr>
<tr>
<td height="75" align="center" valign="bottom"><span class="a1">${dfsf_zhh }</span></td>
</tr>
<tr>
<td height="75" align="center" valign="bottom"><span class="a1">${ywsf_zhh }</span></td>
</tr>
<tr>
<td height="70" align="center" valign="bottom"><span class="a1">${qs_rl }</span></td>
</tr>
<tr>
<td height="75" align="center" valign="bottom"><span class="a1">${ywsf_je }</span></td>
</tr>
</table></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="9" background="images/bg01.gif"></td>
</tr>
</table>
4.right .jsp
<%@ page language="java" pageEncoding="gb2312"%>
<html>
<head>
<title>内容页面</title>
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body style='OVERFLOW:SCROLL;OVERFLOW-X:HIDDEN;'>
<form name="form1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="363"></td><!-- <img src="images/login01.gif" width="777" height="480"> -->
</tr>
</table>
</form>
</body>
</html>
5.foot .jsp
<%@ page language="java" pageEncoding="gb2312"%>
<html>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/di01.gif" width="1024" height="40" border="0" usemap="#Map"></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="26,11,144,31" href="ShowCharServlet?param=ywl" target="right">
<area shape="rect" coords="277,12,381,28" href="ShowCharServlet?param=dfzj" target="right">
<area shape="rect" coords="168,11,255,30" href="ShowCharServlet?param=myd" target="right">
<area shape="rect" coords="409,11,520,32" href="ShowCharServlet?param=dfywl" target="right">
<area shape="rect" coords="552,11,648,32" href="ShowCharServlet?param=ywzj" target="right">
<area shape="rect" coords="678,10,802,31" href="ShowCharServlet?param=ywslhs" target="right">
<area shape="rect" coords="834,11,974,31" href="ShowCharServlet?param=ywslrl" target="right">
</map>
</body>
</html>
FOR:其他参考代码
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
left .jsp
<%@ page language="java" pageEncoding="gbk"%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/bg01c.gif" width="20">
</td>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/bg01d.gif" bgcolor="#f5fffa" height="34" style="width: 708px">
</td>
</tr>
<tr>
<td bgcolor="#f5fffa" valign="top" style="width: 708px">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="height: 19px">
</td>
</tr>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="90%">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="20">
<font color="#000000">
<img height="20" src="images/USER0.GIF" width="20" />
</font>
</td>
<td>
<font color="#000000"> 用户名:</font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<img align="absMiddle" border="0" height="22" src="images/midminus1.gif" width="16" /><img
align="absMiddle" border="0" height="16" src="images/FOLDER01.GIF" width="16" />
<a href="###实现此功能###"><span style="color: #333333">评价数据统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/MAILBOX.GIF"
width="16" />
<a href="yeWu.do?param=yewufenbu" target="right"><span style="color: #333333">业务分布统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" src="images/LINE.GIF" /><img align="absMiddle" src="images/MIDBLK.GIF" /><img
align="absMiddle" border="0" height="16" src="images/SEND_BOX.GIF" width="16" />
<a href="MainServlet?param=manyishuju" target="right"><span style="color: #333333">满意数据分析</span></a></td>
</tr>
<tr style="color: #333333">
<td style="height: 22px">
<img align="absMiddle" src="images/LINE.GIF" /><img align="absMiddle" src="images/MIDBLK.GIF" /><img
align="absMiddle" border="0" height="16" src="images/SEARCH.GIF" width="16" />
<a href="MainServlet?param=xiangxishuju" target="right"><span style="color: #333333">详细数据查询</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" border="0" height="22" src="images/midminus1.gif" width="16" /><img
align="absMiddle" border="0" height="16" src="images/FOLDER01.GIF" width="16" />
<a href="##############"><span style="color: #333333">营销数据统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" src="images/LINE.GIF" /><img align="absMiddle" src="images/MIDBLK.GIF" /><img
align="absMiddle" border="0" height="16" src="images/TOOLS.GIF" width="16" />
<a href="MainServlet?param=yewuliang" target="right"><span style="color: #333333">业务量统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" src="images/LINE.GIF" /><img align="absMiddle" src="images/MIDBLK.GIF" /><img
align="absMiddle" border="0" height="16" src="images/TEMP_BOX.GIF" width="16" />
<a href="MainServlet?param=zijin" target="right""><span style="color: #333333">业务资金统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/SIZE.GIF"
width="16" />
<a href="MainServlet?param=dfsf" target="right""><span style="color: #333333">电费收费统计</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" border="0" height="22" src="images/midminus1.gif" width="16" /><img
align="absMiddle" border="0" height="16" src="images/FOLDER01.GIF" width="16" />
<a href="###########3#"><span style="color: #333333">组织机构管理</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/REFUSE.GIF"
width="16" />
<a href="yeWu.do?param=dishi" target="right""><span style="color: #333333">地市信息</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/NEW_MAIL.gif"
width="16" />
<a href="yeWu.do?param=guiyuan" target="right""><span style="color: #333333">柜员信息</span></a></td>
</tr>
<tr style="color: #333333">
<td style="height: 22px">
<img align="absMiddle" border="0" height="22" src="images/midminus1.gif" width="16" /><img
align="absMiddle" border="0" height="16" src="images/FOLDER01.GIF" width="16" />
<a href="#########3#"><span style="color: #333333">系统管理</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/take_mail.gif"
width="16" />
<a href="yeWu.do?param=yonghu" target="right""><span style="color: #333333">用户管理</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" height="22" src="images/LINE.GIF" width="16" /><img align="absMiddle"
src="images/MIDBLK.GIF" /><img align="absMiddle" border="0" height="16" src="images/RESUME.GIF"
width="16" />
<a href="infor.do" target="right"><span style="color: #333333">个人信息</span></a></td>
</tr>
<tr style="color: #333333">
<td>
<img align="absMiddle" border="0" height="22" src="images/LASTBLK.GIF" width="16" /><img
align="absMiddle" border="0" height="16" src="images/EXIT.GIF" width="16" />
<a href="login.jsp" target="right"><span
style="color: #333333"> 退 出</span></a></td>
</tr>
</table>
<p>
<br />
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<八>一个简单的 不安全的 login .jsp
package com.suypower.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.suypower.db.DBCon;
public class LoginServlet extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
String userid=request.getParameter("userId");
String psw=request.getParameter("userMm");
HttpSession session=request.getSession();
session.setAttribute("userid",userid);
try{
Connection con=new DBCon().getConnection();
Statement stmt=con.createStatement();
String sql1="select count(User_ID) as zongshu from PJ_User where User_ID='"+userid+"' and User_MM='"+psw+"'";
ResultSet rs1=stmt.executeQuery(sql1);
rs1.next();
String noing=rs1.getString("zongshu");
if(noing.equals("0"))
{
RequestDispatcher rd=request.getRequestDispatcher("error.jsp");
rd.forward(request, response);
}else
{
RequestDispatcher rd=request.getRequestDispatcher("frameset.jsp");
rd.forward(request, response);
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
}
FOR; 用struts + hibernate 验证用户 login .jsp
package com.suypower.struts;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import DBConnect.DBConn;
public class LoginAction extends Action
{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws Exception
{
// System.out.print("11111111111111111111");
ActionForward actionForward=new ActionForward();
// LoginForm lf=(LoginForm)form;
// String userID=lf.getUserId();
// String userMM=lf.getUserMm();
// System.out.println("222222222222222222");
// String sql="from PjUser as pj where pj.userId=:PJuserId and pj.userMm=:PJuserMm";
// //判断用户
// System.out.print("3333333333333");
// try{
// Session session=HibernateSessionFactory.getSession();
// //HibernateSessionFactory.getSession();
// //new Configuration().configure().buildSessionFactory().openSession();
// System.out.println("44444444444444");
// Transaction tx=session.beginTransaction();
// System.out.println("5555555555555555");
// Query query=session.createQuery(sql);
// System.out.println("666666666666666666");
// query.setString("PJuserId", userID);
// query.setString("PJuserMm", userMM);
// tx.commit();
// System.out.println("777777777777777777777");
// if(query.list().size()>0)
// {
// session.close();
// return mapping.findForward("frameset");
// }
// else
// {
// return mapping.findForward("error");
// }
// }catch(HibernateException e)
// {
// e.printStackTrace();
// }
// return actionForward;
String userid=request.getParameter("userId");
String psw=request.getParameter("userMm");
HttpSession session=request.getSession();
session.setAttribute("userid",userid);
Connection con=new DBConn().getConnection();
// String sql="select User_ID,User_MM,Popedom_ID from PJ_User where User_ID='"+userid+"' and User_MM='"+psw+"'";
// System.out.print(sql);
Statement stmt=con.createStatement();
// ResultSet rs=stmt.executeQuery(sql);
// while(rs.next())
// {
// String name=rs.getString("User_ID");
// String password=rs.getString("User_MM");
// String popodomID=rs.getString("Popedom_ID");
// session.setAttribute("popodomID", popodomID);
// }
String sql1="select count(User_ID) as zongshu from PJ_User where User_ID='"+userid+"' and User_MM='"+psw+"'";
ResultSet rs1=stmt.executeQuery(sql1);
rs1.next();
String noing=rs1.getString("zongshu");
System.out.println("ddddddddddddddd"+noing);
if(noing.equals("0"))
{
System.out.println("wwwwwwwwwwwww"+rs1.getRow());
return actionForward=mapping.findForward("error");
}
if(rs1.getRow()>0)
{
System.out.println("sssssssssssssss"+rs1.getRow());
return actionForward=mapping.findForward("frameset");
}
return actionForward;
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<九>: 一个地市 信息 显示 绑订到数据库 显示 连接 (联到删除 什么对应的 功能)
<%@ page language="java" pageEncoding="gb2312"%>
<%@ page import="Test.SjbdDishi" %>
<html>
<body>
<div align="center">
<table>
<tr><th>统计信息:共有${count }个地市<th></tr>
</table>
<br>
<table width="75%" border=1>
<tr><th>地市</th><th>地市区号</th><th>查看</th></tr>
<%
SjbdDishi ds=new SjbdDishi();
ds.getDSsjbd(request,out);
%>
</table>
</div>
</body>
</html>
package Test;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspWriter;
import DBConnect.DBConn;
public class SjbdDishi {
public void getDSsjbd(HttpServletRequest request,JspWriter out)
{
HttpSession session=request.getSession();
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
DBConn db = new DBConn();
conn = db.getConnection();
stmt = conn.createStatement();
String sql = "select City_ID,City_NAME from dbo.PJ_City";
rs = stmt.executeQuery(sql);
while (rs.next())
{
int count=rs.getRow();
session.setAttribute("count", count);
String cityID=rs.getString("City_ID");
String cityNAME=rs.getString("City_NAME");
out.print("<tr><td>"+cityID+"</td><td>"+cityNAME+"</td>");
out.print("<td><a href=dsView.do?param="+rs.getString("City_ID")+">查看</a></td>");
}
} catch (Exception e) {
e.getMessage();
} finally {
try {
rs.close();
stmt.close();
conn.close();
} catch (Exception e) {
}
}
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
jdbc 连接
package com.suypower.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DBCon {
final private String driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver";
final private String driverURL="jdbc:sqlserver://172.23.23.3:1433;databaseName=pjtest";
final private String username="pj";
final private String password="pj3023";
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
public Connection getConnection()
{
try
{
Class.forName(driverName);
}catch(ClassNotFoundException e)
{
System.out.println("%%%连接驱动失败%%%");
e.printStackTrace();
}
try
{
con=DriverManager.getConnection(driverURL,username,password);
}catch(SQLException e)
{
e.printStackTrace();
System.out.println("%%%连接数据库失败%%%");
}
finally
{
}
return con;
}
}
%%%%%%%%%%%%%%%%%%%%%%-2007-12-18-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
extremeComponents 的删除 和编辑弹出页面 实现
1。分页信息输出
<div align="center" id="cz" >
<ec:table
action="${pageContext.request.contextPath}/BmServlet"
items="arrayBM"
var="a"
imagePath="${pageContext.request.contextPath}/images/table/*.gif"
width="99%"
tableId="resultTable1"
rowsDisplayed="10"
form="frm"
filterable="false"
sortable="false"
autoIncludeParameters="false">
<ec:row>
<ec:column property="city_id" title="【所属地市】" width="16%"></ec:column>
<ec:column property="county_id" title="【分县公司】" width="16%"></ec:column>
<ec:column property="bm_id" title="【所属部门】" width="16%"></ec:column>
<ec:column property="person_id" title="【员工工号】" width="16%"></ec:column>
<ec:column property="person_name" title="【员工姓名】" width="16%"></ec:column>
<ec:column property="【编辑】" title="" width="10%">
<input type="button" value="编辑" name="space">
</ec:column>
<ec:column property="【删除】" title="" width="10%">
<input type="button" value="删除" onclick="del('${a.person_id }')">
</ec:column>
</ec:row>
</ec:table>
<input type="hidden" name="shanchu">
</div>
2。
。。。。
。。。
function del(person_id)
{
document.frm.change.value="shanchu";
document.frm.shanchu.value=person_id;
frm.submit();
}
</script>
3。servlet 获取参数 然后 连接数据库 执行删除
。。。
。。。。
if(param.equals("shanchu"))
{
String person_id=request.getParameter("shanchu");
//写SQL语句 删除
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
System.out.println(person_id);
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
编辑
思路:用分页组件 extremecomponents 实现 编辑
然后 传参数
用JS实现 弹出页面
页面上是用JSP
然后用的是 JS限制格式
JSP action=到 SERVLET
SERVLET 获取 参数
连接数据库 update 数据 即可
很清晰的思路哦
代码:
<div align="center" id="cz" >
<ec:table
action="${pageContext.request.contextPath}/BmServlet"
items="arrayBM"
var="a"
imagePath="${pageContext.request.contextPath}/images/table/*.gif"
width="99%"
tableId="resultTable1"
rowsDisplayed="10"
form="frm"
filterable="false"
sortable="false"
autoIncludeParameters="false">
<ec:row>
<ec:column property="city_id" title="【所属地市】" width="16%"></ec:column>
<ec:column property="county_id" title="【分县公司】" width="16%"></ec:column>
<ec:column property="bm_id" title="【所属部门】" width="16%"></ec:column>
<ec:column property="person_id" title="【员工工号】" width="16%"></ec:column>
<ec:column property="person_name" title="【员工姓名】" width="16%"></ec:column>
<ec:column property="【编辑】" title="" width="10%">
<input type="button" value="编辑" onclick="edit('${a.person_id }','${a.city_id }','${a.county_id }','${a.bm_id }','${a.person_name }')" >
</ec:column>
<ec:column property="【删除】" title="" width="10%">
<input type="button" value="删除" onclick="del('${a.person_id }')">
</ec:column>
</ec:row>
</ec:table>
<input type="hidden" name="shanchu">
</div>
....
...
function edit(person_id,city_id,county_id,bm_id,person_name)
{
url="edit.jsp?personid="+person_id+"&cityid="+city_id+"&countyid="+county_id+"&bmid="+bm_id+"&personName="+person_name;
//alert(url);
window.open(url,'newwindow','height=250,width=400,top=200,left=200,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
}
</script>
JSP
<%@ page language="java" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<%
String personid=new String(request.getParameter("personid").getBytes("iso8859-1"),"gbk");
String cityid=new String(request.getParameter("cityid").getBytes("iso8859-1"),"gbk");
String countyid=new String(request.getParameter("countyid").getBytes("iso8859-1"),"gbk");
String bmid=new String(request.getParameter("bmid").getBytes("iso8859-1"),"gbk");
String personName=new String(request.getParameter("personName").getBytes("iso8859-1"),"gbk");
%>
<form action="EditServlet" method="post">
<table>
<tr><td>用户ID:</td><td><%= personid %></td></tr>
<tr><td>用户名:</td><td><%= personName %></td></tr>
<tr><td>城市:</td><td><%= cityid %></td></tr>
<tr><td>区县:</td><td><input type="text" value="<%= countyid %>" name="aaa"></td></tr>
<tr><td>部门:</td><td><input type="text" value="<%= bmid %>" name="bbb"></td></tr>
<tr>
<td>是否为服务人员:</td>
<td>
<select name="fuwu">
<option>是</option>
<option>否</option>
</select>
</td></tr>
<tr><td><input type="submit" value="确定"></td></tr>
</table>
</form>
</body>
</html>
Servlet
。。。。。。。。。
获取表单信息 写SQL 更新 即可 很简单的 这里就不给代码了
//////////////////////////////////////////////////2007-12-19//////////////////////////////////////////////////////////。。。。。。。。。。。。。。。AJAX 联动。。。。。。。。。。。。。。。
ajax
<%@ page language="java" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
This is my ajax JSP page. <br>
<head>
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
if(window.ActionXObject)
{
xmlHttp=new ActionXObject("Microsoft.XMLHTTP");
}
elst if(window.XMLHttpRequest)
{
xmlHttp=new XMLHttpRequest();
}
function startRequest()
{
createXMLHttpRequest();
xmlHttp.onreadystatechange=handleStateChange;
xmlRequest.open("get","innerHTML",true);
xmlHttp.send(null);
}
function handleStateChange()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
document.getElementById("results").innerHTML=xmlHttp.responseText;
}
}
}
}
</script>
</head>
<body>
<form action="#">
<input type="button" value="ajax" onclick="startRequest();"/>
<div id="results"></div>
</form>
</body>
</html>
innerHTML.xml
...
.....
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ajax 实现级联下拉 更新 数据库
<head>
<script language ="javascript">
var http_request = false;
function createXMLHttpRequest()
{
if(window.ActiveXObject)
{ //IE浏览器
http_request=new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}
function Change_Select(){
var cityID=document.frm.city.value;
createXMLHttpRequest();
http_request.onreadystatechange=callback;
http_request.open("get","TestServlet?cityid="+cityID,true);
http_request.send(null);
}
function callback(){
if(http_request.readyState == 4)
{
if(http_request.status == 200)
{
var str=http_request.responseText;
if(str!=null)
{
var field=str.split("|");
}
document.getElementById("county").length=0;//调用之前先置为空
for(var i=0;i<field.length-1;i++)
{
var option=field[i].split(",");
document.frm.county.add(new Option(option[0],option[0]));
}
}else {
alert("http_request.status == 200 失败");
}
}
}
</script>
</head>
<body>
<form name="frm" action="YwlServlet" method="post">
.......................
<select name="city" onChange="Change_Select()">
<option>==请先选择地市==</option>
<option value="025">南京</option>
<option value="0511">镇江</option>
<option value="0519">常州</option>
....................
.................
...
<td>
<select name="county">
<option>==所有区县==</option>
</select>
</td>
..............
servlet
...
..
package com.suypower.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.suypower.db.DBCon;
public class TestServlet extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("gb2312");
response.setContentType("text/html");
response.setCharacterEncoding("gb2312");
doPost(request,response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
//String cityID=request.getParameter("cityid");
Connection con=null;
Statement stmt=null;
PrintWriter out=response.getWriter();
request.setCharacterEncoding("gb2312");
response.setContentType("text/html");
response.setCharacterEncoding("gb2312");
try{
con=new com.suypower.db.DBCon().getConnection();
stmt=con.createStatement();
String sql="select county_name from pj_county";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next())
{
String county_name=rs.getString("county_name");
out.print(county_name+"|");
}
}catch(SQLException e){e.printStackTrace();}
}
}
¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥
程雨__级联菜单__树型结构
不要着急 我们 来 先看看API
Overview
Functions
add
openAll
closeAll
openTo
Configuration
Functions
add()
Adds a node to the tree.
Can only be called before the tree is drawn.
id, pid and name are required.
Parameters
Name Type Description
id Number Unique identity number.
pid Number Number refering to the parent node. The value for the root node has to be -1.
name String Text label for the node.
url String
发表评论
-
java 生成 验证码
2012-09-04 17:05 4664<script type="text/ja ... -
读取 properties
2012-08-21 17:19 1229import java.io.File; import ja ... -
eXtremeComponents 分页列表
2012-08-03 09:25 1719<%@taglib uri="/WEB-INF ... -
Map套map 前台jstl遍历
2012-08-02 10:56 2285public String queryAdminPoped ... -
MD5加密
2012-07-19 17:08 1119public class MD5psw { /** * M ... -
CSVReader
2012-07-03 08:49 9029package com.zte.nva.dap.hadoop. ... -
java调用linux shell命令
2012-06-20 19:06 2031/** * 调用shell命令,创建android ... -
反编译插件jad安装 MyEclipse8.5
2012-04-23 10:45 1369准备工作 下载jad.exe文件:http://www ... -
强化不可实例化能力
2011-09-28 15:54 872有时候我们会编一些只含有静态域和静态方法的类,用私有构造函数强 ... -
持续集成环境配置
2011-09-27 10:58 851见附件 见附件 -
Serializable demo
2011-09-23 14:45 992/** * serialization 序列化 * s ... -
junit4 @test DEMO
2011-09-15 16:15 5265package com.isoftstone.ecc.juni ... -
重写@Override toString
2011-07-20 14:30 1655/** * UserBean.java * com ... -
request.getParameterNames()和request.getParameterValues()
2011-06-09 16:38 4482request.getParameterNames()和r ... -
java基础の解析 map
2011-05-19 14:06 1530package com.csdn; import jav ... -
java Swing 的excel 操作 -导入导出 (原型)
2011-04-14 17:01 4659package com.excel; import ... -
java 发送EMAIL邮件
2011-04-14 15:56 1030import java.util.Date; import ... -
java和JSTL遍历map
2011-04-14 15:50 1324public Map<Integer,List<M ... -
MyEclipseGen
2011-03-12 11:26 1014myeclipse的激活码自动生成 import java.i ... -
TimerTask
2011-03-01 21:42 1188import java.util.Timer; import ...
相关推荐
5. **市场规模预测**:易观国际预计2010年手机游戏市场规模将达95亿,空中网2008年的收入突破2千万,其中手机游戏包括单机游戏和在线网游,后者通过虚拟道具收费。 **市场问题** 1. **社交网络(SNS)局限性**:...
而“2008年1月1日 随笔档案 - Liugang的博客 - 博客园.mht”可能包含了一些个人的开发经验或技巧,也有可能与connection连线的实现有关。 综合以上信息,我们可以深入探讨connection连线样式的实现,包括但不限于...
基于Maxwell设计的经典280W 4025RPM高效率科尔摩根12极39槽TBM无框力矩电机:生产与学习双重应用案例,基于Maxwell设计的经典280W高转速科尔摩根TBM无框力矩电机:7615系列案例解析与应用实践,基于maxwwell设计的经典280W,4025RPM 内转子 科尔摩根 12极39槽 TBM无框力矩电机,7615系列。 该案例可用于生产,或者学习用,(157) ,maxwell设计; 280W; 4025RPM内转子; 科尔摩根; 12极39槽TBM无框力矩电机; 7615系列; 生产/学习用。,基于Maxwell设计,高功率280W 12极39槽TBM无框力矩电机:生产与学习双用途案例
基于碳交易的微网优化模型的Matlab设计与实现策略分析,基于碳交易的微网优化模型的Matlab设计与实现探讨,考虑碳交易的微网优化模型matlab ,考虑碳交易; 微网优化模型; MATLAB;,基于Matlab的碳交易微网优化模型研究
二级2025模拟试题(答案版)
OpenCV是一个功能强大的计算机视觉库,它提供了多种工具和算法来处理图像和视频数据。在C++中,OpenCV可以用于实现基础的人脸识别功能,包括从摄像头、图片和视频中识别人脸,以及通过PCA(主成分分析)提取图像轮廓。以下是对本资源大体的介绍: 1. 从摄像头中识别人脸:通过使用OpenCV的Haar特征分类器,我们可以实时从摄像头捕获的视频流中检测人脸。这个过程涉及到将视频帧转换为灰度图像,然后使用预训练的Haar级联分类器来识别人脸区域。 2. 从视频中识别出所有人脸和人眼:在视频流中,除了检测人脸,我们还可以进一步识别人眼。这通常涉及到使用额外的Haar级联分类器来定位人眼区域,从而实现对人脸特征的更细致分析。 3. 从图片中检测出人脸:对于静态图片,OpenCV同样能够检测人脸。通过加载图片,转换为灰度图,然后应用Haar级联分类器,我们可以在图片中标记出人脸的位置。 4. PCA提取图像轮廓:PCA是一种统计方法,用于分析和解释数据中的模式。在图像处理中,PCA可以用来提取图像的主要轮廓特征,这对于人脸识别技术中的面部特征提取尤
麻雀搜索算法(SSA)自适应t分布改进版:卓越性能与优化代码注释,适合深度学习。,自适应t分布改进麻雀搜索算法(TSSA)——卓越的学习样本,优化效果出众,麻雀搜索算法(SSA)改进——采用自适应t分布改进麻雀位置(TSSA),优化后明显要优于基础SSA(代码基本每一步都有注释,代码质量极高,非常适合学习) ,TSSA(自适应t分布麻雀位置算法);注释详尽;高质量代码;适合学习;算法改进结果优异;TSSA相比基础SSA。,自适应T分布优化麻雀搜索算法:代码详解与学习首选(TSSA改进版)
锂电池主动均衡Simulink仿真研究:多种均衡策略与电路架构的深度探讨,锂电池主动均衡与多种均衡策略的Simulink仿真研究:buckboost拓扑及多层次电路分析,锂电池主动均衡simulink仿真 四节电池 基于buckboost(升降压)拓扑 (还有传统电感均衡+开关电容均衡+双向反激均衡+双层准谐振均衡+环形均衡器+cuk+耦合电感)被动均衡电阻式均衡 、分层架构式均衡以及分层式电路均衡,多层次电路,充放电。 ,核心关键词: 锂电池; 主动均衡; Simulink仿真; 四节电池; BuckBoost拓扑; 传统电感均衡; 开关电容均衡; 双向反激均衡; 双层准谐振均衡; 环形均衡器; CUK均衡; 耦合电感均衡; 被动均衡; 电阻式均衡; 分层架构式均衡; 多层次电路; 充放电。,锂电池均衡策略研究:Simulink仿真下的多拓扑主动与被动均衡技术
S7-1500和分布式外围系统ET200MP模块数据
内置式永磁同步电机无位置传感器模型:基于滑膜观测器和MTPA技术的深度探究,内置式永磁同步电机基于滑膜观测器和MTPA的无位置传感器模型研究,基于滑膜观测器和MTPA的内置式永磁同步电机无位置传感器模型 ,基于滑膜观测器;MTPA;内置式永磁同步电机;无位置传感器模型,基于滑膜观测与MTPA算法的永磁同步电机无位置传感器模型
centos7操作系统下安装docker,及docker常用命令、在docker中运行nginx示例,包括 1.设置yum的仓库 2.安装 Docker Engine-Community 3.docker使用 4.查看docker进程是否启动成功 5.docker常用命令及nginx示例 6.常见问题
给曙光服务器安装windows2012r2时候找不到磁盘,问厂家工程师要的raid卡驱动,内含主流大多数品牌raid卡驱动
数学建模相关主题资源2
西门子四轴卧式加工中心后处理系统:828D至840D支持,四轴联动制造解决方案,图档处理与试看程序一应俱全。,西门子四轴卧加后处理系统:支持828D至840D系统,四轴联动高精度制造解决方案,西门子四轴卧加后处理,支持828D~840D系统,支持四轴联动,可制制,看清楚联系,可提供图档处理试看程序 ,核心关键词:西门子四轴卧加后处理; 828D~840D系统支持; 四轴联动; 制程; 联系; 图档处理试看程序。,西门子四轴卧加后处理程序,支持多种系统与四轴联动
MATLAB下基于列约束生成法CCG的两阶段鲁棒优化问题求解入门指南:算法验证与经典文献参考,MATLAB下基于列约束生成法CCG的两阶段鲁棒优化问题求解入门指南:算法验证与文献参考,MATLAB代码:基于列约束生成法CCG的两阶段问题求解 关键词:两阶段鲁棒 列约束生成法 CCG算法 参考文档:《Solving two-stage robust optimization problems using a column-and-constraint generation method》 仿真平台:MATLAB YALMIP+CPLEX 主要内容:代码构建了两阶段鲁棒优化模型,并用文档中的相对简单的算例,进行CCG算法的验证,此篇文献是CCG算法或者列约束生成算法的入门级文献,其经典程度不言而喻,几乎每个搞CCG的两阶段鲁棒的人都绕不过此篇文献 ,两阶段鲁棒;列约束生成法;CCG算法;MATLAB;YALMIP+CPLEX;入门级文献。,MATLAB代码实现:基于两阶段鲁棒与列约束生成法CCG的算法验证研究
“生热研究的全面解读:探究参数已配置的Comsol模型中的18650圆柱锂电池表现”,探究已配置参数的COMSOL模型下的锂电池生热现象:18650圆柱锂电池模拟分析,出一个18650圆柱锂电池comsol模型 参数已配置,生热研究 ,出模型; 18650圆柱锂电池; comsol模型; 参数配置; 生热研究,构建18650电池的COMSOL热研究模型
移动端多端运行的知识付费管理系统源码,TP6+Layui+MySQL后端支持,功能丰富,涵盖直播、点播、管理全功能及礼物互动,基于UniApp跨平台开发的移动端知识付费管理系统源码:多端互通、全功能齐备、后端采用TP6与PHP及Layui前端,搭载MySQL数据库与直播、点播、管理、礼物等功能的强大整合。,知识付费管理系统源码,移动端uniApp开发,app h5 小程序一套代码多端运行,后端php(tp6)+layui+MySQL,功能齐全,直播,点播,管理,礼物等等功能应有尽有 ,知识付费;管理系统源码;移动端uniApp开发;多端运行;后端php(tp6);layui;MySQL;直播点播;管理功能;礼物功能,知识付费管理平台:全功能多端运行系统源码(PHP+Layui+MySQL)
基于Python+Django+MySQL的个性化图书推荐系统:协同过滤推荐,智能部署,用户定制功能,基于Python+Django+MySQL的个性化图书推荐系统:协同过滤推荐,智能部署,用户定制功能,Python+Django+Mysql个性化图书推荐系统 图书在线推荐系统 基于用户、项目、内容的协同过滤推荐算法。 帮远程安装部署 一、项目简介 1、开发工具和实现技术 Python3.8,Django4,mysql8,navicat数据库管理工具,html页面,javascript脚本,jquery脚本,bootstrap前端框架,layer弹窗组件、webuploader文件上传组件等。 2、项目功能 前台用户包含:注册、登录、注销、浏览图书、搜索图书、信息修改、密码修改、兴趣喜好标签、图书评分、图书收藏、图书评论、热点推荐、个性化推荐图书等功能; 后台管理员包含:用户管理、图书管理、图书类型管理、评分管理、收藏管理、评论管理、兴趣喜好标签管理、权限管理等。 个性化推荐功能: 无论是否登录,在前台首页展示热点推荐(根据图书被收藏数量降序推荐)。 登录用户,在前台首页展示个性化推荐
STM32企业级锅炉控制器源码分享:真实项目经验,带注释完整源码助你快速掌握实战经验,STM32企业级锅炉控制器源码:真实项目经验,完整注释,助力初学者快速上手,stm32真实企业项目源码 项目要求与网上搜的那些开发板的例程完全不在一个级别,也不是那些凑合性质的项目可以比拟的。 项目是企业级产品的要求开发的,能够让初学者了解真实的企业项目是怎么样的,增加工作经验 企业真实项目网上稀缺,完整源码带注释,适合没有参与工作或者刚学stm32的增加工作经验, 这是一个锅炉的控制器,有流程图和程序协议的介绍。 ,stm32源码;企业级项目;工作经验;锅炉控制器;流程图;程序协议,基于STM32的真实企业级锅炉控制器项目源码
整车性能目标书:涵盖燃油车、混动车及纯电动车型的十六个性能模块目标定义模板与集成开发指南,整车性能目标书:涵盖燃油车、混动车及纯电动车型的十六个性能模块目标定义模板与集成开发指南,整车性能目标书,汽车性能目标书,十六个性能模块目标定义模板,包含燃油车、混动车型及纯电动车型。 对于整车性能的集成开发具有较高的参考价值 ,整车性能目标书;汽车性能目标书;性能模块目标定义模板;燃油车;混动车型;纯电动车型;集成开发;参考价值,《汽车性能模块化目标书:燃油车、混动车及纯电动车的集成开发参考》