Browsed JSP code
<% @ Page Language = "Java" contenttype = "text/html; charset = UTF-8" %>
<% @ Include file = "../common/newtag. jsp" %>
<% @ Page import = "Java. util. Calendar" %>
<% @ Page import = "Java. util. Date" %>
<% @ Page import = "Java. util. List" %>
<% @ Page import = "Java. util. arraylist" %>
<% @ Page import = "Java. util. Map" %>
<% @ Page import = "com. database. Operate. datamanagefactory" %>
<% @ Page import = "com. database. SQL. classtype" %>
<% @ Page import = "com. datacollect. floatreportvo" %>
<%
String excelnameschecked = request. getparameter ("excelname ");
List exclenamescheckedlist = new arraylist ();
If (excelnameschecked! = NULL &&! "". Equals (excelnameschecked )){
String [] excelnamescheckedarray = excelnameschecked. Split (",");
For (INT I = 0; I <excelnamescheckedarray. length; I ++ ){
Exclenamescheckedlist. Add (excelnamescheckedarray [I]);
}
}
List excelnames = NULL;
String pyear = request. getparameter ("year ");
String pmonth = request. getparameter ("month ");
If (pyear! = NULL & pmonth! = NULL)
Try {
Excelnames = datamanagefactory. getoperater (). Query (classtype. reportmanage, "query_zd_falldata_reports", null );
} Catch (exception e ){}
%>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> right </title>
<Link href = "<% = request. getcontextpath () %>/CSS/main.css" rel = "stylesheet" type = "text/CSS"/>
<Link href = "<% = request. getcontextpath () %>/JS/datejs/calendar.css" rel = "stylesheet" type = "text/CSS"/>
</Head>
<Body onload = "getdcstatusbyexcelnames ();">
<Table Style = "border: # d7d7d7 solid 1px" Height = "100%" width = "100%" border = "0" cellspacing = "0" cellpadding = "0">
<Tr>
<TD Height = "18">
<Div style = "Background: URL (../c_img/win_bg.jpg); Height: 18px;
Border-bottom: #999 solid 1px; margin: auto 0 ">
<Span style = "float: Left; margin-left: 5px; color: #545487; font-weight: bold; margin-top: 2px; padding: 0px; display: block "> report list </span>
<Span style = "float: Right; color: #545487; font-weight: bold; margin-Right: 5px; margin-top: 4px; margin-top: 2px; padding: 0px; display: block; font-size: 0.7em; font-size: 0.9em; cursor: Pointer "> </span>
</Div>
</TD>
</Tr>
<Tr Height = "20">
<TD>
<Div class = "tools_div">
<Ul class = "in all H">
Billing Cycle selection:
<Select id = "year">
<%
Calendar c = calendar. getinstance ();
Date curdate = new date ();
C. settime (curdate );
Int now = C. Get (calendar. year );
Int month = C. Get (calendar. month );
Int startyear = now-5;
Int maxyear = now + 10;
Int yearint = now; int monthint = month;
If (pyear! = NULL) {yearint = integer. parseint (pyear );}
If (pmonth! = NULL) {monthint = integer. parseint (pmonth. substring (0, 1). Equals ("0 ")? Pmonth. substring (1): pmonth );}
For (INT I = startyear; I <= maxyear; I ++) {%>
<Option value = "<% = I %>" <% if (I = yearint) {out. print ("selected") ;}%><%= I %> </option>
<% }%>
</SELECT>
Year
<Select id = "month">
<% For (INT I = 1; I <10; I ++) {%>
<Option <% if (I = monthint) {out. print ("selected") ;}%> value = "<% =" 0 "+ I %>"> <% = "0" + I %> </option>
<% }%>
<% For (INT I = 10; I <13; I ++) {%>
<Option <% if (I = monthint) {out. print ("selected") ;}%> value = "<%= I %>" ><%= I %> </option>
<% }%>
</SELECT>
Month
</Ul>
<Ul class = "in OK H">
<Li> <span onclick = "OpenWindow ()"> OK </span> </LI>
</Ul>
</Div>
</TD>
</Tr>
<Tr>
<TD id = "main_td" width = "100%" Height = "85%">
<Div style = "width: 100%; Height: 100%; overflow: Auto">
<Table id = "" class = "table_style tr_h" border = "0" cellspacing = "0" cellpadding = "0">
<Colgroup>
<Col class = "vzebra-one" width = "20px"/>
<Col class = "vzebra-odd"/>
<Col class = "vzebra-one" width = "20px"/>
</Colgroup>
<Tr>
<TD> </TD>
<TD> report name </TD>
<TD> drilling </TD>
<TD> Status </TD>
</Tr>
<%
If (excelnames! = NULL ){
Int rownumber = 1;
For (INT I = 0; I <excelnames. Size (); I ++ ){
Map excelnamesmap = (MAP) excelnames. Get (I );
%>
<Tr>
<TD> <input type = "checkbox" name = "tablenamecheckbox" tablename = "<% = excelnamesmap. get ("excel_name") %> "<% = exclenamescheckedlist. contains (string) excelnamesmap. get ("excel_name "))? "Checked = 'checked'": "" % >></TD>
<TD> <a href = "#" onclick = "changed ('<% = excelnamesmap. get ("excel_name") %> '); "> <% = excelnamesmap. get ("excel_name") %> </a> </TD>
<TD> 0 </TD>
<%
String dcstatus = (string) excelnamesmap. Get ("collect_status ");
If ("0". Equals (dcstatus )){
Dcstatus = "<font color = \" # ff9900 \ "> not executed </font> ";
}
If ("1". Equals (dcstatus )){
Dcstatus = "<font color = \" #33cc00 \ "> summary successful </font> ";
}
If ("2". Equals (dcstatus )){
Dcstatus = "<font color = \" # ff0000 \ "> summary failed </font> ";
}
%>
<TD> <Div id = "<% = excelnamesmap. Get (" excel_name ") %>"> 123 </div> </TD>
</Tr>
<%
}
}
%>
</Table>
</Div>
</TD>
</Tr>
<Tr Height = "30px">
<TD style = "Background: # e4e4ec;">
<SPAN class = "tools_div">
<Ul onclick = "selectall ()" style = "cursor: Hand">
<% -- <Li> <span> select all </span> </LI> -- %>
<Span> </span>
</Ul>
<Ul onclick = "invertselect ()" style = "cursor: Hand">
<% -- <Li> <span> reselect </span> </LI> -- %>
<Span> </span>
</Ul>
<Ul style = "cursor: Hand">
<Span> <input type = "button" value = "" onclick = "collect ()" style = "height: 25px;"/> </span>
<Ul>
</Span>
</TD>
</Tr>
</Table>
</Body>
<Script language = "JavaScript">
Function OpenWindow (){
VaR month = Document. getelementbyid ('month'). value;
If (month = NULL ){
Month = "<% = pmonth %> ";
}
VaR year = Document. getelementbyid ('Year'). value;
If (year = NULL ){
Year = "<% = pyear %> ";
}
Window. Location. href = './datacollectleft. jsp? Year = '+ year +' & month = '+ month;
}
Function collect (){
VaR tablenames = [];
VaR CHS = Document. getelementsbyname ("tablenamecheckbox ");
VaR Len = CHS. length;
VaR I = 0;
For (I = 0; I <Len; I ++ ){
If (CHS [I]. Checked ){
Tablenames. Push (CHS [I]. tablename );
}
}
If (tablenames. Length = 0 ){
Alert ("Select Report ");
Return;
}
VaR repnames = tablenames. Join (',');
If (confirm ("are you sure you want to summarize the selected reports? "))
Window. Location. href = 'collectdata. jsp? Year = <% = pyear %> & month = <% = pmonth %> & excelname = '+ repnames;
Alert ("1-3 minutes for summary calculation ");
Window. Location. href = 'datacollectleft. jsp? Year = <% = pyear %> & month = <% = pmonth %> & excelname = '+ repnames;
}
Function changed (rptname ){
VaR commend = rptname;
Parent. ed_main.location = "datacollectmain. jsp? Excelname = "+ commend +" & year = <% = pyear %> & month = <% = pmonth %> ";
}
Function selectall (){
VaR CHS = Document. getelementsbyname ("tablenamecheckbox ");
VaR Len = CHS. length;
VaR I = 0;
For (I = 0; I <Len; I ++ ){
CHS [I]. Checked = true;
}
}
Function invertselect (){
VaR CHS = Document. getelementsbyname ("tablenamecheckbox ");
VaR Len = CHS. length;
VaR I = 0;
For (I = 0; I <Len; I ++ ){
CHS [I]. Checked =! (CHS [I]. Checked );
}
}
Function go (name, year, month, org ){
// Alert (name );
Parent. ed_main.location = "fetchmain. jsp? Name = "+ name +" & year = "+ year +" & month = "+ month +" & ORG = "+ org;
Parent. ed_banner.location = "fetchtop. jsp? Name = "+ name +" & year = "+ year +" & month = "+ month +" & ORG = "+ org;
}
// Create an Ajax object
VaR Ajax = new function ()
{
This. _ url = "./dcstatus. jsp ";
// Create an XMLHTTPRequest object
This. createxmlhttp = function (){
VaR XMLHTTP = NULL;
// Use different creation methods based on whether the window. XMLHTTPRequest object exists
If (window. XMLHttpRequest ){
XMLHTTP = new XMLHttpRequest ();
} Else if (window. activexobject ){
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
} Else if (window. activexobject ){
XMLHTTP = new activexobject ("msxml2.xmlhttp. 4.0 ");
} Else if (window. activexobject ){
XMLHTTP = new activexobject ("msxml2.xmlhttp ");
}
Return XMLHTTP;
}
// Obtain the summary status
This. getcdstatus = function (exclename)
{
VaR bbname = exclename;
VaR XMLHTTP = This. createxmlhttp (); // create an XMLHTTPRequest object
XMLHTTP. onreadystatechange = function ()
{
If (XMLHTTP. readystate = 4)
{
If (XMLHTTP. Status = 200 ){
VaR xmldoc = XMLHTTP. responsexml;
VaR node = xmldoc. getelementsbytagname ("dcstatus ");
Document. getelementbyid (exclename). innerhtml = node (0). firstchild. nodevalue; // get the XML response
SetTimeout ("Ajax. getcdstatus ('" + exclename + "')", "5000"); // query once every 5 seconds
} Else {
Alert ("server fault ");
}
}
}
VaR url = This. _ URL + "? Exclename = "+ exclename;
XMLHTTP. Open ("get", encodeuri (URL), true );
XMLHTTP. Send (null );
}
}
// Obtain the summary status based on the selected report.
Function getdcstatusbyexcelnames (){
VaR tablenames = [];
VaR CHS = Document. getelementsbyname ("tablenamecheckbox ");
VaR Len = CHS. length;
VaR I = 0;
For (I = 0; I <Len; I ++ ){
If (CHS [I]. Checked ){
Tablenames. Push (CHS [I]. tablename );
}
}
<%
If (excelnameschecked! = NULL &&! "". Equals (excelnameschecked )){
%>
Tablenamestr = "<% = excelnameschecked %> ";
Tablenames = tablenamestr. Split (",");
<%
}
%>
For (I = 0; I <tablenames. length; I ++ ){
Ajax. getcdstatus (tablenames [I]);
}
}
</SCRIPT>
</Html>
Search the database and generate the xml jsp code
<% @ Page Language = "Java" contenttype = "text/html; charset = UTF-8" %>
<% @ Page import = "com. datacollect. floatreportvo" %>
<%
String exclename = request. getparameter ("exclename ");
Floatreportvo frvo = new floatreportvo (exclename );
String dcstatus = frvo. getcollect_status ();
If ("0". Equals (dcstatus )){
Dcstatus = "<font color = \" # ff9900 \ "> not executed </font> ";
}
If ("1". Equals (dcstatus )){
Dcstatus = "<font color = \" #33cc00 \ "> summary successful </font> ";
}
If ("2". Equals (dcstatus )){
Dcstatus = "<font color = \" # ff0000 \ "> summary failed </font> ";
}
Response. setcontenttype ("text/XML; charset = UTF-8 ");
Response. setheader ("cache-control", "No-Cache ");
Stringbuffer sb = new stringbuffer ();
SB. append ("<? XML version = \ "1.0 \" encoding = \ "UTF-8 \"?> ");
SB. append ("<dcstatus> ");
SB. append ("<! [CDATA [");
SB. append (dcstatus );
SB. append ("]> ");
SB. append ("</dcstatus> ");
Response. getwriter (). Write (sb. tostring ());
%>