- 浏览: 471293 次
- 性别:
- 来自: 南京
文章分类
最新评论
-
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 4654<script type="text/ja ... -
读取 properties
2012-08-21 17:19 1218import java.io.File; import ja ... -
eXtremeComponents 分页列表
2012-08-03 09:25 1713<%@taglib uri="/WEB-INF ... -
Map套map 前台jstl遍历
2012-08-02 10:56 2273public String queryAdminPoped ... -
MD5加密
2012-07-19 17:08 1115public class MD5psw { /** * M ... -
CSVReader
2012-07-03 08:49 9007package com.zte.nva.dap.hadoop. ... -
java调用linux shell命令
2012-06-20 19:06 2025/** * 调用shell命令,创建android ... -
反编译插件jad安装 MyEclipse8.5
2012-04-23 10:45 1362准备工作 下载jad.exe文件:http://www ... -
强化不可实例化能力
2011-09-28 15:54 859有时候我们会编一些只含有静态域和静态方法的类,用私有构造函数强 ... -
持续集成环境配置
2011-09-27 10:58 844见附件 见附件 -
Serializable demo
2011-09-23 14:45 983/** * serialization 序列化 * s ... -
junit4 @test DEMO
2011-09-15 16:15 5254package com.isoftstone.ecc.juni ... -
重写@Override toString
2011-07-20 14:30 1647/** * UserBean.java * com ... -
request.getParameterNames()和request.getParameterValues()
2011-06-09 16:38 4475request.getParameterNames()和r ... -
java基础の解析 map
2011-05-19 14:06 1499package com.csdn; import jav ... -
java Swing 的excel 操作 -导入导出 (原型)
2011-04-14 17:01 4637package com.excel; import ... -
java 发送EMAIL邮件
2011-04-14 15:56 1023import java.util.Date; import ... -
java和JSTL遍历map
2011-04-14 15:50 1309public Map<Integer,List<M ... -
MyEclipseGen
2011-03-12 11:26 1008myeclipse的激活码自动生成 import java.i ... -
TimerTask
2011-03-01 21:42 1168import java.util.Timer; import ...
相关推荐
"Java完整随笔(学习)"可能包含了一系列关于Java编程的基础到高级概念的笔记,是学习Java的好资源。以下是一些可能涵盖的重要知识点: 1. **Java基础**:这部分可能包括了Java的基本语法,如变量、数据类型、...
Java 记录随笔 Java 记录随笔是关于 Java 软件架构设计的笔记,涵盖了软件架构的基本原则、当前流行的技术、数据库存储结构、Web 界面用户接口层、业务层架构、持久层技术、XML 结构化信息传输和存储的重要性等多个...
Java 调试技术概述 Java 调试是指使用程序调试工具来检查和纠正 Java 程序中的错误和异常。调试是软件开发过程中不可或缺的一步,它可以帮助开发者更好地理解程序的执行流程,从而提高程序的质量和可靠性。 Debug...
【Java - 框架 - Knife4j】随笔 在Java Web开发中,文档的生成与维护是一项重要但繁琐的工作。Knife4j,作为一款专门为Java RESTful API设计的文档增强工具,它极大地简化了这个过程,为开发者带来了诸多便利。本篇...
Java中的方法是编程中至关重要的概念,它封装了一段可重复使用的代码,使得程序更加模块化,提高了代码的复用性和可读性。方法的定义和调用是编写Java程序的基础。 方法的定义通常包括访问修饰符(如public)、静态...
之前上传了JAVA笔记1 那么这次是JAVA笔记2 衔接上一次的
Java中的数组是一种基础且重要的数据结构,用于存储同种数据类型的多个值。数组提供了一种高效的方式来管理和操作一组数据,可以是整数、浮点数、字符或自定义对象。在Java中,数组的定义有两种格式: 1. `数据类型...
java课堂随笔,我这还有很多,有需要的话可以联系我,我会为大家提供很多的资料
本项目是一款基于Java和跨平台技术的crostitch涂鸦随笔设计与实现源码,包含65个文件,其中包括30个Java源文件、16个PNG图片文件、7个JavaScript文件、2个XML文件、1个Git忽略文件、1个Markdown文件、1个Maven项目...
Java编程语言中,进制是理解计算机底层运算的基础。进制是指进位制,即在进行数字运算时,逢特定基数进位。例如,十进制逢十进一,二进制逢二进一,八进制逢八进一,十六进制则是逢十六进一。学习不同进制能帮助我们...
JavaThings - Java安全漫谈笔记相关《Java安全漫谈》是我在写的一点Java学习相关的随笔,不是很严谨,也不是啥高。这个存储库主要是记录并整理一下,附加一些代码。Java 安全漫谈目录Java安全漫谈 - 01.Java的动态...
IntelliJ IDEA,简称IDEA,是一款广受好评的Java集成开发环境,由JetBrains公司开发。它以其高效、智能的编码辅助和丰富的功能集,成为许多开发者首选的Java编程工具。IDEA不仅支持Java,还支持其他多种编程语言如...
在本文中,我们将深入探讨如何在Ubuntu操作系统上搭建一个完整的Java项目运行环境,包括安装Java Development Kit (JDK) 1.8、MySQL 5.7数据库服务以及Apache Tomcat 9应用服务器。这个过程对于任何希望在Linux环境...
在现代Web应用开发中,Java和JavaScript经常协同工作,实现前后端交互。Java代码调用HTML5中的JS函数算法是一项关键技术,它使得服务器端能够直接操纵客户端的网页元素,提高用户体验,同时也为复杂业务逻辑提供了...
很抱歉,但根据您给出的信息,标题和描述中提到的是"网恋随笔散文随笔散文.rar",这明显与IT行业知识不相符,而更倾向于文学或个人创作。标签虽为"教育",但没有具体的IT教育相关知识点。压缩包子文件的文件名称列表...
工程数学软件实用入门资料,可视很好,不需要专门的语言。
关于描写夏天的散文随笔.doc
作者是享誉国内外的Java高手,除了技术相关的文章之外,他也没有僭越自己的专业,随笔中所提及的都是软件产业里的甘苦点滴。不眠之夜,一本蔡学镛的《Java夜未眠》恰能适应你的心情,就像一杯清香醇厚的咖啡,让孤独...
"散文随笔【黄牛散文随笔】.rar" 是一个压缩文件,其中包含了由作者“黄牛”创作的散文随笔集合。这个标题指示我们,这是一份文学作品,主要涵盖了散文和随笔这两种文体,可能包含作者对生活、社会、自然等各方面的...
SpringSecurity是Java领域中一款强大的安全框架,主要用于Web应用程序的安全管理,包括认证和授权。它提供了全面的安全控制,从简单的密码编码到复杂的访问控制策略,为开发者提供了丰富的功能。本随笔将深入探讨...