📄 mylayoutchannel.java
字号:
import java.io.*;
import java.text.*;
import java.util.*;
import java.sql.*;
/*
*
*
* @author zhukejun
*/
public class MyLayoutChannel
{
public void MakeLayoutInfo( Person p,TemplateList tempList,HtmlOut servlet,int pagenum )
{
SingleTemplate st = tempList.searchTemplate("ROOT");
if(st==null)
{
servlet.setErrorID (servlet.SINGLE_TEMPLATE_NOTFIND,"",
"single template layout is not find","Login");
servlet.outHtml ();
return;
}
boolean bool=false;
String username,zai="",kuan="",queryString,pagestring;
int i,j=0,k=0,zaicount,allcount,kuancount;
username=p.username;
//get zaichannel to String[] zaichannel;
String zaichannel[][];
zaichannel=new String[100][2];
DBOperater DB = new DBOperater ("userchannel");
queryString ="select channelname,a.channelid from channel a,userchannel b where b.type=1 and b.username='"+CommonMethods.DealWithSQLParameter(username)+"' and b.pagenumber="+pagenum+" and b.channelid=a.channelid order by orderid";
ResultSet rs = DB.executeQuery (queryString);
i=0;
if(rs!=null){
try{
while(rs.next())
{
zaichannel[i][0] = rs.getString(1).trim();
zaichannel[i][1] = rs.getString(2).trim();
i=i+1;
}
}catch(Exception e){
}
}
zaicount=i;
//get kuan channel to String[] kuanchannel;
String kuanchannel[][];
kuanchannel=new String[100][2];
queryString ="select channelname,a.channelid from channel a,userchannel b where b.type=2 and b.username='"+CommonMethods.DealWithSQLParameter(username)+"' and b.pagenumber="+pagenum+" and b.channelid=a.channelid order by orderid";
rs = DB.executeQuery (queryString);
i=0;
if(rs!=null){
try{
while(rs.next())
{
kuanchannel[i][0] = rs.getString(1).trim();
kuanchannel[i][1] = rs.getString(2).trim();
i=i+1;
}
}catch(Exception er){
}
}
kuancount=i;
allcount=zaicount+kuancount;
DB.close ();
//...替换关键字
int nKey = st.getKeyNum ();
for(i=0;i<nKey;i++){
servlet.addString (st.getStringAt (i));
String sKey = st.getKeyAt (i);
if( sKey .compareTo("cgi-path")==0 )
servlet.addString (CommonMethods.sHostNameCGI);
if(sKey.compareTo ("pagenumber")==0){
pagestring="<INPUT name=p type=hidden value="+pagenum+">";
servlet.addString(pagestring);
}
if(sKey.compareTo ("当前页")==0){
pagestring=""+pagenum+"";
servlet.addString(pagestring);
}
if(sKey.compareTo ("窄")==0){
for(j=0;j<zaicount;j++)
{
zai=zai+"<option value="+zaichannel[j][1]+">"+zaichannel[j][0]+"</option>";
}
servlet.addString(zai);
}
if(sKey.compareTo ("宽")==0){
for(j=0;j<kuancount;j++)
{
kuan=kuan+"<option value="+kuanchannel[j][1]+">"+kuanchannel[j][0]+"</option>";
}
servlet.addString(kuan);
}
}
servlet.addString (st.getEndString () );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -