锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
閿欒浠e彿 鍗佸叚榪涘埗 閿欒綾誨瀷
1001 0x800A03E9 鍐呭瓨涓嶈凍
1002 0x800A03EA 璇硶閿欒
1003 0x800A03EB 闇瑕?#8220; 錛?”
1004 0x800A03EC 闇瑕?#8220; 錛?”
1005 0x800A03ED 闇瑕?#8220; 錛?”
1006 0x800A03EE 闇瑕?#8220; 錛?”
1007 0x800A03EF 闇瑕?#8220; [ ”
1008 0x800A03F0 闇瑕?#8220; ] ”
1009 0x800A03F1 闇瑕?#8220;{ ”
1010 0x800A03F2 闇瑕?#8220; } ”
1011 0x800A03F3 闇瑕佹爣蹇楃
1012 0x800A03F4 闇瑕?#8220; / ”
1013 0x800A03F5 鏃犳晥鏁?/span>
1014 0x800A03F6 闈炴硶瀛楃
1015 0x800A03F7 瀛楃涓插父閲忔湭緇撴潫
1016 0x800A03F8 娉ㄨ鏈粨鏉?/span>
1018 0x800A03FA 鍑芥暟澶栨湁"return"璇彞
1019 0x800A04FB 鍦ㄥ驚鐜 涓嶈兘鏈?#8220;break“
1020 0x800A05FC 鍦ㄥ驚鐜 涓嶈兘鏈?#8220;continue“
1023 0x800A03FF 闇瑕佸崄鍏埗鏁?/span>
1024 0x800A0400 闇瑕?while"
1025 0x800A0401 鏍囩瀹氫箟閲嶅
1026 0x800A0402 鏈壘鍒版爣絳?/span>
1027 0x800A0403 涓鏉?switch"璇彞涓彧鑳芥湁涓涓?default"
1028 0x800A0404 闇瑕佹爣璇嗙錛屽瓧絎︿覆鎴栬呮暟瀛?/span>
1029 0x800A0405 闇瑕?@end"
1030 0x800A0406 鏉′歡緙栬瘧宸插叧闂?/span>
1031 0x800A0407 闇瑕佸父鏁?/span>
1032 0x800A0408 闇瑕?@"
1033 0x800A0409 闇瑕?"catch"
1034 0x800A040A 闇瑕?var"
1035 0x800A041B "Throw" 鐨勫悗闈㈠繀欏昏窡涓涓〃杈懼紡錛屼笖鍦ㄥ悓涓
婧愪唬鐮佽涓?/span>
private int curPage;//褰撳墠欏墊暟
private int maxPage;//鏈澶ч〉鏁?br />
private int maxRowCount;//鎬昏褰曟暟
private int pageSize=2;//姣忛〉鏄劇ず鐨勮褰曟暟
private DBResult db;//璁板綍闆嗗璞?br />
private String httpfile;//褰撳墠鍦板潃鏍忕殑鏂囦歡錛屽嵆鍏蜂綋鐨刯sp鏂囦歡
private String cif;//閫夋嫨鐨勬煡璇㈠瓧孌?br />
private String ccif;//閫夋嫨鐨勬煡璇㈣繍綆楃
private String qvalue;//鏌ヨ鍏抽敭瀛?br />
private String countSql=null;//鐢ㄦ潵瀛樺偍select count錛?錛夈傘傘傘傝鍙?br />
private String topSql=null;//鐢ㄦ潵瀛樺偍select top2.銆傘傘傝鍙?br />
private String nowPage=null;//鍒濆鍖栧綋鍓嶉〉curPage鍙橀噺錛屽嵆鑾峰緱褰撳墠欏電殑鍏蜂綋欏靛彿
private String str_parameter;//鍦ㄥ仛緲婚〉鏃訛紝浼犻掗櫎pages澶栫殑鍏朵粬鍙傛暟
private String andor;//鏌ヨ鐨勪笌/鎴栨潯浠?br />
private String sdate;//鏌ヨ鍏跺疄鏃墮棿
private String edate;//鏌ヨ緇撴潫鏃墮棿
private String paixu;//鎺掑簭鏂規(guī)硶
private String orderby;//鎺掑簭鏉′歡
public QuestString() throws Exception{
db=new DBResult();
}
public void setCurPage(int curPage){
this.curPage=curPage;
}
public void setQuerySql(String httpfile,String pages,String strCount){
this.httpfile=httpfile;
this.nowPage=pages;
this.countSql=strCount;
try{
querySql(countSql);
}catch(Exception e){
e.printStackTrace();
}
}
public void querySql(String countSql)throws SQLException {
// TODO Auto-generated method stub
if(this.nowPage==null){
this.curPage=1;
}else{
this.curPage=Integer.parseInt(this.nowPage);
if(this.curPage<1){
this.curPage=1;
}
}
ResultSet rsCount=db.getResult(countSql);
if(rsCount.next()){
this.maxRowCount=rsCount.getInt(1);//鑾峰彇璁板綍鎬繪暟錛屽嵆鎵瑕佹煡璇㈣褰曠殑鎬昏
}
//浣欐暟涓?鍒欐婚〉鏁?涓ゆ暟鏁撮櫎鐨勭粨鏋滐紝鑻ヤ笉涓?鍒欐婚〉鏁?涓ゆ暟鏁撮櫎緇撴灉+1
this.maxPage=(this.maxRowCount%this.pageSize==0)?(this.maxRowCount/this.pageSize):
(this.maxRowCount/this.pageSize+1);
if(this.curPage>this.maxPage){
this.curPage=this.maxPage;
}
rsCount.close();
}
public String pageFooter()
{
String str="<form action="+this.httpfile+"name=formBean method=post>";
int prev=this.curPage-1;//鍓嶄竴欏?br />
int next=this.curPage+1;//鍚庝竴欏?br />
str=str+"<font style='font-size:10pt'>鎬昏<font color='red'>"+this.getMaxRowCount()+
"</font>鏉¤褰曪紝"+"“鍏?lt;font color='red'>"+this.getMaxPage()+"</font>欏?#8221;";
str=str+" ”<font color='red'>"+this.pageSize+"</font>鏉?欏?#8221;褰撳墠欏?lt;font color='red'>"+
this.getMaxPage()+"</font>欏?amp;nbsp;";
if(this.curPage>1)
str=str+"<A href="+this.httpfile+"?pages=1"+str_parameter+">棣栭〉</A>";
else
str=str+"棣栭〉";
if(this.curPage>1)
str=str+"<A href="+this.httpfile+"?pages="+prev+str_parameter+">涓婁竴欏?lt;/A>";
else
str=str+"涓婁竴欏?;
if(this.curPage<this.maxPage)
str=str+"<A href="+this.httpfile+"?pages="+next+str_parameter+">涓嬩竴欏?lt;/A>";
else
str=str+"涓嬩竴欏?;
if(this.maxPage>1&&this.curPage!=this.maxPage)
str=str+"<A href="+this.httpfile+"?pages="+this.maxPage+str_parameter+">灝鵑〉</A>";
else
str=str+"灝鵑〉</font>";
//鍦ㄩ〉闈㈣煩杞棿璁劇疆闅愯棌琛ㄥ崟錛屾潵淇濆瓨涓嶅悓鐨勮姹?br />
str=str+"杞埌<input type='text' name='pages' size=2>欏?+
"<input type='hidden' name='ccif' value='"+this.ccif+"'>" +
"input type='hidden' name='cif' value='"+this.cif+
"'><input type='hidden' name='qvalue' value='"+this.qvalue+
"'><input type='hidden' name=andor' value='"+this.andor+
"'><input type='hidden name='sdate' value='"+this.sdate+
"'><input type='hidden name='edate' value='"+this.edate+
"'><input type='hidden' name='orderby' value='"+this.orderby+
"'><input type='hidden' name='paixu' value='"+this.paixu+
"'><input type='submit' name='submit' value='go'></form>";
return str;
}
private int getMaxPage() {
// TODO Auto-generated method stub
return maxPage;
}
private int getMaxRowCount() {
// TODO Auto-generated method stub
return maxRowCount;
}
//鏍規(guī)嵁涓嶅悓鏉′歡鑾峰彇涓嶅悓鏌ヨ鍓峃鏉$殑SQL璇彞
public String getString(String table){
if(ccif.equals("="))
{
String strSql="select top"+this.pageSize*this.curPage+"*from"+table+"where"+
""+cif+"="+"'"+qvalue+"'";
return strSql;
}
else if(ccif.equals("LIKE"))
{
String strSql="select top"+this.pageSize*this.curPage+"*from"+table+
"where"+""+cif+""+"like"+""+"'%"+qvalue+"%'";
return strSql;
}
else if(ccif.equals("ALL")){
String strSql="select top"+this.pageSize*this.curPage+"*from"+table;
return strSql;
}
else if(ccif.equals("<"))
{
String strSql="select top"+this.pageSize*this.curPage+"*from"+table+
"where"+cif+"<'"+qvalue+"'";
return strSql;
}
return null;
}
//鏍規(guī)嵁涓嶅悓鏉′歡鑾峰彇涓嶅悓鐨勮綆楄褰曟繪暟鐨凷QL璇彞
public String getCount(String table){
if(ccif.equals("=")){
String strSql="select count(*) from"+table+"where"+""+cif+"="+"'"+qvalue+"'";
return strSql;
}
else if(ccif.equals("LIKE")){
String strSql="select count(*) from"+table+"where"+""+cif+""+"like"+""+"'%"+qvalue+"%'";
return strSql;
}
else if(ccif.equals("ALL")){
String strSql="select count(*) from"+table;
return strSql;
}
else if(ccif.equals("<")){
String strSql="select count(*) from "+table+"where"+cif+"<'"+qvalue+"'";
return strSql;
}
return null;
}
//鏍規(guī)嵁涓嶅悓鏉′歡鍜屼笉鍚岀殑璧峰鏃ユ湡鍜岀粨鏉熸棩鏈熻幏寰椾笉鍚岀殑璁$畻璁板綍鎬繪暟鐨凷QL璇彞
public String getDateCount(String table){
if(ccif.equals("=")){
String strSql="select count(*) from"+table+"where"+""+cif+"="+"'"+qvalue+"'"+
andor+"xsdate between'"+sdate+"'and'"+edate+"'";
return strSql;
}
else if(ccif.equals("LIKE")){
String strSql="select count(*) from"+table+"where"+""+cif+""+"like"+""+"'%"+qvalue+"%'"+
andor+"xsdate between'"+sdate+"'and'"+edate+"'";
return strSql;
}
else if(ccif.equals("ALL")){
String strSql="select count(*) from"+table;
return strSql;
}
return null;
}
//鏍規(guī)嵁涓嶅悓鏉′歡鍜屼笉鍚岀殑璧峰鏃ユ湡鍜岀粨鏉熸棩鏈熻幏寰椾笉鍚岀殑鏌ヨ錛屽墠N鏉$殑SQL璇彞
public String getDateString(String table){
if(ccif.equals("="))
{
String strSql="select top"+this.pageSize*this.curPage+"*from"+table+"where"+
""+cif+"="+"'"+qvalue+"'"+andor+"xsdate between'"+sdate+"'and'"+edate+"'";
return strSql;
}
else if(ccif.equals("LIKE"))
{
String strSql="select top"+this.pageSize*this.curPage+"*from"+table+
"where"+""+cif+""+"like"+""+"'%"+qvalue+"%'"+andor+"xsdate between'"+sdate+
"'and'"+edate+"'";
return strSql;
}
else if(ccif.equals("ALL")){
String strSql="select top"+this.pageSize*this.curPage+"*from"+table;
return strSql;
}
return null;
}
//瀛愭煡璇腑寰楀埌浠庤搗濮嬫棩鏈熷埌緇撴潫鏃ユ湡榪欐鏃墮棿鎵鏈変笉閲嶅鐨剆pid錛堝晢鍝乮d錛夛紝騫惰繑鍥炰笉閲嶅鐨剆pid鐨勬繪暟
//鍏朵腑spid鏄竴涓暟鎹簱涓竴寮犺〃涓殑涓涓睘鎬э紙涓鍒楋級錛屽厓緇勶紙涓琛岋級
public String getOrderCount(String table){
String strSql="select count(*) from (select spid from"+table+"where xsdate between'"+
sdate+"'and'"+edate+"'group by spid) as aa";
return strSql;
}
public String getOrderString(String table){
String strSql="select top"+this.pageSize*this.curPage+"* from tb_brand a inner join" +
"(select spid,sum(sl)as sl,sum(je)as je"+
"from "+table+"where xsdate between'"+sdate+"'and'"+edate+"'group by spid)"+
"as b"+"on a.id=b.spid order by"+orderby+""+paixu;
return strSql;
}
}
/**
* @author huangqin
*
*/
public class DBConn {
public static synchronized Connection getConnection() throws Exception{
try{
Context initCtx=new javax.naming.InitialContext();//鑾峰彇JNDI鍒濆涓婁笅鏂囧璞?br />
//鍦↗NDI鍛藉悕絀洪棿java錛歝omp/env孌甸噷鑾峰緱涓婁笅鏂囧璞?br />
Context envCtx=(Context)initCtx.lookup("java:comp/env");
DataSource ds=(DataSource)envCtx.lookup("jdbc/xscj");
return ds.getConnection();
}catch(SQLException e){
throw e;
}catch(NamingException ex){
throw ex;
}
}
}
package test;
import java.sql.*;
import test.DBConn;
/**
* @author huangqin
*
*/
public class DBResult {
private Connection con;
public DBResult() throws Exception{//涓瀹氳鎶涘嚭寮傚父錛屽惁鍒欐姤閿?br />
this.con=DBConn.getConnection();
}
public ResultSet getResult(String sql){
try{
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(sql);
return rs;
}catch(Exception e){
return null;
}
}
public void doExecute(String sql){
try{
Statement stmt=con.createStatement();
stmt.executeQuery(sql);
}catch(Exception e){}
}
public PreparedStatement getPreparedStatement(String sql){
try{
PreparedStatement pstmt=con.prepareStatement(sql);
return pstmt;
}catch(Exception e){
return null;
}
}
public void closeConn(){
try{
this.con.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
鏁版嵁婧愭帴鍙ava.sql.DataSource鐨勪竴浜涙柟娉曞涓嬶細(xì)
getConnection錛堬級錛氳幏寰椾竴涓狢onnection瀵硅薄銆?br />
getConnection錛圫tring username錛孲tring password錛夛紱鑾峰緱涓涓甫鏈夌敤鎴峰悕鍜屽瘑鐮佺殑Connction瀵硅薄銆?br />
getLongWriter錛堬級錛涗粠DataSource涓幏寰桳ongWriter瀵硅薄錛屽畠鏄疨rinterWriter鐨勫疄渚?br />
setLongWriter錛圥rintWriter out錛夛細(xì)璁劇疆Datasource鐨凩ongWriter
getLOginTimeout錛堬級:鑾峰緱DataSource灝濊瘯榪炴帴鏁版嵁搴撶殑鏈澶ф椂闂?br />
SetLoginTimeout(int seconds):璁劇疆DataSource灝濊瘯榪炴帴鏁版嵁搴撶殑鏈澶ф椂闂?br />
public class MyString
{
//瀵瑰瓧絎︿覆榪涜GBK緙栫爜
public static String toChinese(String strvalue){
try{
if(strvalue=null){
return ;;;
}
else{
strvalue=new String(strvalue銆俫etBytes("ISO8859_1"),"GBK");
return strvalue錛?br />
}
}catch(Exception e){
return "";
}
}
}
//瀵硅緭鍏ョ殑瀛楃涓茶繃婊ql娉ㄥ叆
public static String StringtoSql(String str){
str=nullToString錛坰tr,"");
try{
str=str.trim().replace("\",(char)1);
}catch(Exception e){
return "";
}
return str;
}
//璇誨彇鏁版嵁搴撲腑鏁版嵁鏃訛紝榪囨護(hù)sql娉ㄥ叆
public static String SqltoString(String str){
str=nullToString(str,"");
try{
str=str.replace((char)1,"\").trim();
}catch(Exception e){
return "";
}
return str;
}
//瀵瑰瓧絎︿覆榪涜Unicode緙栫爜
public static String toUnicode(String strvalue){
try{
if(strvalue==null){
return null;
}else{
strvalue=new String(strvalue.getBytes("GBK"),"ISO8895_1");
return strvalue;
}
}catch(Exception e){
return "";
}
}
//鍒ゆ柇褰撳墠鏃墮棿
public static boolean compareNowTime(String date){
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
Date d=null;
try{
d=format.parse(date);
}catch(ParseException ex){
}
if(System.currentTimeMillis()-259200000<d.getTime()){
return true;
}
return false;
}
//鍒ゆ柇鐢ㄦ埛杈撳叆鐨勫瓧絎︽槸鏁板瓧榪樻槸瀛楁瘝
public static boolean isID錛圫tring str){
if(str錛?null&&str.length()>0){
if(str.charAt(0)<57&&str.charAt(0)>48) return false;
for(int i=0;i<str.length();i++){
if(str.charAt(i)<65&&str.charAt(i)>57||str.charAt(i)>90&&str.charAt(i)<97&&
str.charAt(i)!=95||str.charAt(i)>122||str.charAt(i)<48){
return false;
}
}
return true;
}
return false;
}
//瀵硅緭鍏ユ暟鎹腑鐨凥TML瀛楃榪涜杞崲
public static final String escapeHTML Tags(String input){
if(input==null||input.length()==0){
return input錛泒
StringBuffer buf=new StringBuffer(input.length());
char ch='';
for(int i=0;i<input.length();i++){
ch=input.charAt(i);
if(ch=='<'){
buf.append("<");
}else if(ch=='>'){
buf.append(">");
}else{
buf.append(ch); }
}
return buf.toString();
}
//瀵筍QL璇彞涓緭鍏ョ殑絀哄艱繘琛屽鐞?br />
public static final String SqlToLink(String str){
str=StringUtils.nullToString(str,"");
if("".equals(str)){
str="LIKE '%'";
}else{
str=("LIKE '%"+str+"%'");}
return str;
}
}
涓嬮潰鏄敤JS鏉ラ獙璇佽緭鍏ユ暟鎹殑鍚堟硶鎬э細(xì)
<script language="javascript">
function mycheck(){
if(myform.goodsName.value==""){
alert("璇瘋緭鍏ュ晢鍝佸鍚?);
myform.goodsName.focus();
return;
}
if(myform.picture.value==""){
alert("璇瘋緭鍏ュ浘鐗囨枃浠剁殑璺緞");
myform.picture.focus();
return;
}
if(myform.price.value==""){
alert("璇瘋緭鍏ヤ環(huán)鏍?);
myform.price.focus();
return;
}
myform.submit();
}
</script>