|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
市场分额,java比asp高一点,因为C#是仿照java开发的,所以哦C#能做的java都能做到,但是java能做的,C#不一定都能做到。毕竟是抄袭吗。<%!
stc_RSYB_NamestcRSYName1[];
stc_SYB_INFstcSYBINF1[];
%>
<%/*
Stringp=(String)session.getValue("access");
if(p==null||!p.equals("1")){
response.sendRedirect("error.htm");
return;
}*/
%>
<%!
file://失掉呆板名字或IP
Stringget_Myhostname(javax.servlet.http.HttpServletRequestrequest){
Stringmyhostname=null;
try{
myhostname=request.getRemoteHost();
myhostname=myhostname.toUpperCase();
}catch(Exceptione){}
returnmyhostname;
}
file://处置空字符串
StringdealNull(Stringstr){
Stringreturnstr=null;
if(str==null)returnstr="";
elsereturnstr=str;
returnreturnstr;
}
file://处置空对象
ObjectdealNull(Objectobj){
Objectreturnstr=null;
if(obj==null)returnstr=(Object)("");
elsereturnstr=obj;
returnreturnstr;
}
intdealEmpty(Strings){
s=dealNull(s);
if(s.equals(""))return0;
returnInteger.parseInt(s);
}
Stringreplace(Stringstr,Stringsubstr,Stringrestr){
String[]tmp=split(str,substr);
Stringreturnstr=null;
if(tmp.length!=0){
returnstr=tmp[0];
for(inti=0;i<tmp.length-1;i++)
returnstr=dealNull(returnstr)+restr+tmp[i+1];
}
returndealNull(returnstr);
}
StringhtmlEncode(Stringtxt){
txt=replace(txt,"&","&");
txt=replace(txt,"&","&");
txt=replace(txt,""",""");
txt=replace(txt,""",""");
txt=replace(txt,"<","<");
txt=replace(txt,"<","<");
txt=replace(txt,">",">");
txt=replace(txt,">",">");
txt=replace(txt,"","");
txt=replace(txt,"","");
returntxt;
}
StringunHtmlEncode(Stringtxt){
txt=replace(txt,"&","&");
txt=replace(txt,""",""");
txt=replace(txt,"<","<");
txt=replace(txt,">",">");
txt=replace(txt,"","");
returntxt;
}
file://ALERTFunction
voidsAlert(Stringtitle,Stringmsg,Stringfocus,JspWriterout){
try{
out.println("<scriptlanguage=javascript>");
out.println("alert(""+title+""+"
"+""+replace(replace(msg,"",""),""",""")+"");");
out.println(focus);
out.println("</script>");
}catch(Exceptione){System.out.println(e);}
}
file://CONFIRMFunction
voidsConfirm(Stringtitle,Stringmsg,Stringlocation,JspWriterout){
try{
out.println("<scriptlanguage=javascript>");
out.println("if(confirm(""+title+""+"
"+""+replace(msg,""",""")+"")){");
out.println("vard=(newDate()).toString();");
out.println(location+"+d;");
out.println("}");
out.println("parent.document.form1.text1.select();");
out.println("</script>");
}catch(Exceptione){}
}
file://失掉字符串长度
intgetStringLength(Strings){
intp=0;
try{
intiLength=0;
intirealLength=0;
intj=0;
p=s.getBytes("Shift_JIS").length;
}catch(java.io.UnsupportedEncodingExceptione){}
returnp;
}
voidformatString(Strings,intb,JspWriterout){
b--;
Stringt="";
try{
intleng=getStringLength(s);
intj=0;
if(leng>b){
for(inti=1;i<=b;i++){
t=s.substring(0,i);
if(t.getBytes("Shift_JIS").length<=b){
j++;
}elsebreak;
}
file://j=j+1;
file://System.out.println("b="+b+"----"+"j="+j);
for(inti=0;i<j;i++){
if(s.substring(i,i+1).equals(""))
out.print("");
if(!s.substring(i,i+1).equals(""))
out.print(htmlEncode(s.substring(i,i+1)));
}
if(s.substring(0,j).getBytes("Shift_JIS").length==b){
out.print("|");
}else{
out.print("|");
}
}else{
for(inti=0;i<b-leng;i++)
t=t+"";
for(inti=0;i<s.length();i++){
if(s.substring(i,i+1).equals(""))
out.print("");
if(!s.substring(i,i+1).equals(""))
out.print(htmlEncode(s.substring(i,i+1)));
}
out.print(htmlEncode(t+"|"));
}
}catch(Exceptione){System.out.println("----"+e);}
}
file://判别是不是为数字
booleanisNumeric(Stringnumber)
{
try
{
Integer.parseInt(number);
returntrue;
}
catch(NumberFormatExceptionsqo)
{
returnfalse;
}
}
file://判别是不是为日期
Stringmk_date(Stringc_date,intc_mode)
{
Stringwk_buf="";
StringToDay="";
try
{
ToDay=Integer.toString(java.util.Calendar.getInstance().get(java.util.Calendar.YEAR));
switch(c_mode)
{
case0:
{
wk_buf=c_date.substring(2,4)+"/"+c_date.substring(4,6);
if(c_date.length()==8)
{
wk_buf=wk_buf+"/"+c_date.substring(6,8);
}
break;
}
case1:
{
for(inti=0;i<c_date.length();i++)
{
if(c_date.substring(i,i+1)=="")
{
wk_buf=wk_buf+"0";
}
else
{
wk_buf=wk_buf+c_date.substring(i,i+1);
}
}
c_date=wk_buf;
wk_buf="";
if(c_date.substring(0,1)!="0")
{
wk_buf="19";
}
else
{
wk_buf="20";
}
wk_buf=wk_buf+c_date.substring(0,2)+c_date.substring(3,5);
if(c_date.length()==8)
{
wk_buf=wk_buf+c_date.substring(6,8);
}
break;
}
case2:
{
wk_buf=c_date.substring(0,4)+c_date.substring(5,7)+c_date.substring(8,10);
break;
}
case3:
{
for(inti=0;i<c_date.length();i++)
{
if(c_date.substring(i,i+1)=="")
{
wk_buf=wk_buf+"0";
}
else
{
wk_buf=wk_buf+c_date.substring(i,i+1);
}
}
c_date=wk_buf;
wk_buf="";
if(Integer.parseInt(c_date.substring(0,2))>Integer.parseInt(ToDay.substring(2,4)))
{
wk_buf=Integer.toString(Integer.parseInt(ToDay.substring(0,2))-1);
}
else
{
wk_buf=ToDay.substring(0,2);
}
wk_buf=wk_buf+c_date.substring(0,2)+c_date.substring(3,5);
if(c_date.length()==8)
{
wk_buf=wk_buf+c_date.substring(6,8);
}
break;
}
case4:
{
wk_buf=c_date.substring(0,4)+"/"+c_date.substring(4,6)+"/"+c_date.substring(6,8);
break;
}
case5:
{
wk_buf=c_date.substring(0,4)+c_date.substring(5,7);
break;
}
}
}
catch(Exceptione)
{
System.out.println("wrong:"+e);
}
returnwk_buf;
}
intcInt(floatstsid){
intcInt=0;
try{
intstsid1=0;
if(stsid>0){
if((stsid-(int)stsid>0)&&(stsid-(int)stsid!=0.5))
stsid1=(int)(stsid+0.5);
if(stsid-(int)stsid==0.5){
if(((int)(stsid-0.5))%2==0)
stsid1=(int)(stsid-0.5);
else
stsid1=(int)(stsid+0.5);
}
if(stsid-(int)stsid==0)
stsid1=(int)stsid;
}else{
stsid=-stsid;
if((stsid-(int)stsid>0)&&(stsid-(int)stsid!=0.5))
stsid1=-(int)(stsid+0.5);
if(stsid-(int)stsid==0.5){
if(((int)(stsid-0.5))%2==0)
stsid1=-(int)(stsid-0.5);
else
stsid1=-(int)(stsid+0.5);
}
if(stsid-(int)stsid==0)
stsid1=-(int)stsid;
}
cInt=stsid1;
}catch(Exceptione){}
returncInt;
}
longcLng(floatnumb){
intnu=0;
longcLng=0;
try{
nu=cInt(numb);
cLng=(long)nu;
}catch(Exceptione){}
returncLng;
}
floatdealFloat(Strings){
s=dealNull(s);
if(s.equals(""))
return0;
returnFloat.parseFloat(s);
}
String[]split(Stringsource,Stringdiv){
intarynum=0,intIdx=0,intIdex=0,div_length=div.length();
if(source.compareTo("")!=0){
if(source.indexOf(div)!=-1){
intIdx=source.indexOf(div);
for(intintCount=1;;intCount++){
if(source.indexOf(div,intIdx+div_length)!=-1){
intIdx=source.indexOf(div,intIdx+div_length);
arynum=intCount;
}
else{arynum+=2;break;}
}
}elsearynum=1;
}elsearynum=0;
intIdx=0;
intIdex=0;
String[]returnStr=newString[arynum];
if(source.compareTo("")!=0){
if(source.indexOf(div)!=-1){
intIdx=(int)source.indexOf(div);
returnStr[0]=(String)source.substring(0,intIdx);
for(intintCount=1;;intCount++){
if(source.indexOf(div,intIdx+div_length)!=-1){
intIdex=(int)source.indexOf(div,intIdx+div_length);
returnStr[intCount]=(String)source.substring(intIdx+div_length,intIdex);
intIdx=(int)source.indexOf(div,intIdx+div_length);
}
else{
returnStr[intCount]=(String)source.substring(intIdx+div_length,source.length());
break;
}
}
}
else{returnStr[0]=(String)source.substring(0,source.length());returnreturnStr;}
}
else{returnreturnStr;}
returnreturnStr;
}
publicclassstc_RSYB_Name
{
publicintpos=-1;
publicStringNAME="";
publicStringhost="";
publicStringhome1="";
publicStringhome2="";
publicStringhome3="";
}
publicclassstc_SYB_INF
{
Stringreg_name="";
StringG_SYB="";
StringR_SYB="";
}
file://输入空格
voidshowBlank(intnum,JspWriterout){
try{
for(inti=0;i<=num;i++)
out.print("");
}
catch(Exceptione){}
}
Stringg_syb_mk(){
Stringg_syb_mk=null;
StringNIS_M_O="1???????????????????????????????????????????????????????????????";
StringLOCAL_M="?1??????????????????????????????????????????????????????????????";
StringWINNT_DC="????1???????????????????????????????????????????????????????????";
StringNIS_LOCAL="11??????????????????????????????????????????????????????????????";
intRet=0,RecCount=0,K=0;
StringSet_Ret="ssy";
String[]DOMEIN=null;
String[]Group_SYB=null;
intWK_SYB[];
try{
Stringsql="selectcount(*)fromvZ@where话兽like"+NIS_M_O+"or话兽like"+LOCAL_M+"or话兽like"+WINNT_DC+"";
rs=stmt.executeQuery(sql);
if(rs.next()){
RecCount=rs.getInt(1);
rs=null;
}
Stringsql2="select*fromvZ@where话兽like"+NIS_M_O+"or话兽like"+LOCAL_M+"or话兽like"+WINNT_DC+"";
while(rs.next()){
inti=0;
DOMEIN[i]=rs.getString("霓也?);
i++;
}
for(intj=0;j<RecCount;j++){
Stringsql3="select*fromO[vwhere霓也?="+DOMEIN[j]+"";
rs=stmt.executeQuery(sql3);
if(rs.next()){
K=K+1;
Group_SYB[K]=rs.getString("皋侔踢");
}
}
for(intl=0;l<32;l++){
for(intm=0;m<K;m++){
if(Group_SYB[m].substring(l,l+1).equals("1")){
if(l==1){
Set_Ret="1";
}else{
Set_Ret=Set_Ret+"1";
}
break;
}else{
if(m==K){
if(l==1){
Set_Ret="0";
}else{
Set_Ret=Set_Ret+"0";
}
}
}
}
}
g_syb_mk=Set_Ret;
}catch(Exceptione){}
returng_syb_mk;
}
intreCount(Stringstrtable,StringSel)
{
StringmySt="";
intt=0;
ResultSetrsd=null;
try
{
mySt="selectcount(*)adsfrom"+strtable+""+Sel;
rsd=conn.createStatement().executeQuery(mySt);
if(rsd.next())
{
t=rsd.getInt("ads");
}
}
catch(SQLExceptionsqe)
{
System.out.println("ODBCWrong:"+sqe+"+"+mySt);
}
rsd=null;
returnt;
}
intdCount(Stringduan,StringstrTable,StringstrSel)
{
intt=0;
ResultSetrss=null;
try
{
StringmySql="selectcount(*)adsfrom"+strTable+"where"+strSel+"and"+duan+"isnotnull";
rss=conn.createStatement().executeQuery(mySql);
if(rss.next())
{
t=rss.getInt("ads");
}
}
catch(Exceptionsqe)
{
System.out.println(sqe);
}
rss=null;
returnt;
}
StringdLookup(Stringduan,StringstrTable,StringstrSel)
{
StringstrReturn=null;
ResultSetrss=null;
try{
Stringstrsql="select"+duan+"from"+strTable+"where"+strSel;
rss=conn.createStatement().executeQuery(strsql);
if(rss.next()){
strReturn=rss.getString(duan);
}
}catch(java.sql.SQLExceptionsqle){
System.out.println("dLookup_Exception:"+sqle);
}
rss=null;
returnstrReturn;
}
StringrTrim(Stringstr){
Stringrstr=str;
if(str==null)
{
rstr="";
}
else
{
if(str.length()==0)rstr="";
if(str.length()>0)
{
for(inti=str.length();i>0;i--)
{
if(str.substring(i-1,i).equals(""))
rstr=rstr.substring(0,i-1);
elsebreak;
}
}
}
returnrstr;
}
voidsybinf_set(stc_RSYB_Namein_data,stc_SYB_INFout_data)throwsjava.sql.SQLException{
StringNEW_SYB="00000000000000000000000000000000";
out_data.reg_name=in_data.NAME;
Stringsql="";
Stringrdomein1="";
Stringrdomein2="";
Stringrdomein3="";
ResultSetrsf=null;
Statementstf=conn.createStatement();
try{
sql="Select皋侔踢FromO[vWhere霓也?="+in_data.host+"";
rsf=conn.createStatement().executeQuery(sql);
if(rsf.next()){
out_data.G_SYB=dealNull(rsf.getString("皋侔踢"));
}else{
out_data.G_SYB="";
}
}catch(java.sql.SQLExceptionsqle){
System.out.println("111111"+sqle);
}
try{
sql="SelectpFrompWhere霓也?="+in_data.home1+"";
rsf=stf.executeQuery(sql);
if(rsf.next())
rdomein1=dealNull(rsf.getString("p"));
}catch(java.sql.SQLExceptionsqle){
System.out.println("22222"+sqle);
}
try{
sql="SelectpFrompWhere霓也?="+in_data.home2+"";
rsf=stf.executeQuery(sql);
if(rsf.next())
rdomein2=dealNull(rsf.getString("p"));
}catch(java.sql.SQLExceptionsqle){
System.out.println("333333"+sqle);
}
try{
sql="SelectpFrompWhere霓也?="+in_data.home3+"";
rsf=stf.executeQuery(sql);
if(rsf.next())
rdomein3=dealNull(rsf.getString("p"));
}catch(java.sql.SQLExceptionsqle){
System.out.println("444444"+sqle);
}
rsf=null;
stf=null;
Stringp=Char_OR(rdomein1,rdomein2);
if(p.equals(""))p=NEW_SYB;
Stringq=Char_OR(p,rdomein3);
if(q.equals(""))q=NEW_SYB;
out_data.R_SYB=q;
}
StringChar_OR(Stringarg1,Stringarg2){
intlen1=-1,len2=-1,max_len=-1,min_len=-1;
Stringret_sts="";
intlong_f=-1;
len1=arg1.length();
len2=arg2.length();
if(len1==0&&len2>0)
returnarg2;
elseif(len1>0&&len2==0)
returnarg1;
elseif(len1==0&&len2==0)
return"";
ret_sts="";
if(len1>len2){
max_len=len1;
min_len=len2;
long_f=1;
}elseif(len1<len2){
max_len=len2;
min_len=len1;
long_f=2;
}else{
max_len=len1;
min_len=len2;
long_f=0;
}
for(inti=1;i<=max_len;i++){
if(i<=min_len){
if(arg1.substring(i-1,i).equals("1")||arg2.substring(i-1,i).equals("1"))
ret_sts=ret_sts+"1";
else
ret_sts=ret_sts+"0";
}else{
if(long_f==1)
ret_sts=ret_sts+arg1.substring(i-1,i);
elseif(long_f==2)
ret_sts=ret_sts+arg2.substring(i-1,i);
}
}
returnret_sts;
}
%>
<%!
voidwriteFile(StringmyString,Stringtarget_file){
try{
java.io.PrintWriterpw=newjava.io.PrintWriter(newjava.io.FileOutputStream(target_file));
pw.println(myString);
pw.close();
myString="";
}catch(java.io.IOExceptione){
System.out.println(e.getMessage());
}
}
%>
但是对于JAVA技术类的学习,我觉得大课堂反而会影响自身独立思考的过程,因为上课的时候,老师讲课的速度很快为了不遗漏要点,通常会仔细的听, |
|