資源簡(jiǎn)介
分享是一種快樂,提供案例完整,可能會(huì)有出錯(cuò),但都是小問題,應(yīng)該難不倒大家

代碼片段和文件信息
package?com.yxq.action;
import?java.util.List;
import?com.yxq.actionSuper.AdminSuperAction;
import?com.yxq.dao.OpDB;
import?com.yxq.model.CreatePage;
public?class?AdminAction?extends?AdminSuperAction?{
/**?功能:管理員操作-進(jìn)行列表顯示信息?*/
public?String?ListShow(){
request.setAttribute(“mainPage““../info/listshow.jsp“);
session.remove(“adminOP“);
int?infoType=showType.getInfoType();
String?stateType=showType.getStateType();
String?payforType=showType.getPayforType();
session.put(“infoType“Integer.valueOf(infoType));?? //保存已選擇的“信息類別”的選項(xiàng)
session.put(“payforType“payforType); //保存已選擇的“付費(fèi)狀態(tài)”的選項(xiàng)
session.put(“stateType“stateType); //保存已選擇的“審核狀態(tài)”的選項(xiàng)
String?sqlall=““;
String?sqlsub=““;
object[]?params=null;
String?mark=““;
int?perR=8;
if(!stateType.equals(“all“)&&!payforType.equals(“all“)){ //沒有同時(shí)選擇“付費(fèi)狀態(tài)”與“審核狀態(tài)”中的“全部”選項(xiàng)
mark=“1“;
sqlall=“SELECT?*?FROM?tb_info?WHERE?(info_type=?)?AND?(info_state=?)?AND?(info_payfor=?)?ORDER?BY?info_date?DESC“;
sqlsub=“SELECT?TOP?“+perR+“?*?FROM?tb_info?WHERE?(info_type=?)?AND?(info_state=?)?AND?(info_payfor=?)?ORDER?BY?info_date?DESC“;
params=new?object[3];
params[0]=Integer.valueOf(infoType);
params[1]=stateType;
params[2]=payforType;
}else?if(stateType.equals(“all“)&&payforType.equals(“all“)){ //同時(shí)選擇了“付費(fèi)狀態(tài)”與“審核狀態(tài)”中的“全部”選項(xiàng)
mark=“2“;
sqlall=“SELECT?*?FROM?tb_info?WHERE?(info_type=?)?ORDER?BY?info_date?DESC“;
sqlsub=“SELECT?TOP?“+perR+“?*?FROM?tb_info?WHERE?(info_type=?)?ORDER?BY?info_date?DESC“;
params=new?object[1];
params[0]=Integer.valueOf(infoType);
}else?if(payforType.equals(“all“)){ //選擇了“付費(fèi)狀態(tài)”中的“全部”選項(xiàng),“審核狀態(tài)”選項(xiàng)任意
mark=“3“;
sqlall=“SELECT?*?FROM?tb_info?WHERE?(info_type=?)?AND?(info_state=?)?ORDER?BY?info_date?DESC“;
sqlsub=“SELECT?TOP?“+perR+“?*?FROM?tb_info?WHERE?(info_type=?)?AND?(info_state=?)?ORDER?BY?info_date?DESC“;
params=new?object[2];
params[0]=Integer.valueOf(infoType);
params[1]=stateType;
}
else?if(stateType.equals(“all“)){?? //選擇了“審核狀態(tài)”中的“全部”選項(xiàng),“付費(fèi)狀態(tài)”選項(xiàng)任意
mark=“4“;
sqlall=“SELECT?*?FROM?tb_info?WHERE?(info_type=?)?AND?(info_payfor=?)?ORDER?BY?info_date?DESC“;
sqlsub=“SELECT?TOP?“+perR+“?*?FROM?tb_info?WHERE?(info_type=?)?AND?(info_payfor=?)?ORDER?BY?info_date?DESC“;
params=new?object[2];
params[0]=Integer.valueOf(infoType);
params[1]=payforType;
}
String?strCurrentP=request.getParameter(“showpage“);
String?gowhich=“admin_ListShow.action“;
OpDB?myOp=new?OpDB();
CreatePage?createPage=myOp.OpCreatePage(sqlall?paramsperRstrCurrentPgowhich); //調(diào)用OpDB類中的OpCreatePage()方法計(jì)算出總記錄數(shù)、總頁(yè)數(shù),并且設(shè)置當(dāng)前頁(yè)碼,這些信息都封裝到了createPage對(duì)象中
int?currentP=createPage.getCurrentP();
if(currentP>1){
int?top=(currentP-1)*perR;
if(mark.equals(“1“)){
sqlsub=“SELECT?TOP?“+perR+“?*?FROM?tb_info?i?WHERE?(info_type?=??)?AND?(info_payfor?=??)?AND?(info_state?=??)?AND?(info_da
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????967??2010-11-08?23:35??test\.classpath
?????文件????????279??2010-11-08?23:33??test\.myme
?????文件???????1408??2010-11-08?23:36??test\.project
?????文件????????500??2010-11-08?23:33??test\.settings\.jsdtscope
?????文件?????????49??2010-11-08?23:33??test\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2010-11-08?23:33??test\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件???????1866??2007-12-13?22:59??test\cityinfo.xm
?????文件????????234??2010-08-16?18:17??test\connDB.properties
?????文件????????582??2007-11-23?19:15??test\css\st
?????文件????1441792??2012-09-13?23:04??test\Databa
?????文件?????516096??2012-09-13?23:04??test\Databa
?????文件???????1626??2007-11-23?17:00??test\images\admin_exit.gif
?????文件???????1563??2007-11-23?17:00??test\images\admin_index.gif
?????文件??????19278??2007-11-23?18:33??test\images\admin_menu.jpg
?????文件??????69806??2007-11-23?16:50??test\images\admin_top.jpg
?????文件?????????51??2007-11-22?22:23??test\images\back.gif
?????文件???????2120??2007-11-23?03:37??test\images\b_logon.gif
?????文件???????2021??2007-11-23?03:37??test\images\b_reset.gif
?????文件??????16039??2007-11-23?17:44??test\images\default_e.jpg
?????文件??????24241??2007-11-23?17:47??test\images\default_m.jpg
?????文件???????1407??2007-11-23?17:42??test\images\default_t.jpg
?????文件??????27423??2007-11-30?23:43??test\images\end.jpg
?????文件???????1490??2007-12-25?21:51??test\images\leftD.jpg
?????文件????????937??2007-12-25?21:02??test\images\leftS.jpg
?????文件???????6718??2007-11-22?23:54??test\images\logo.gif
?????文件????????262??2007-11-23?03:37??test\images\logon_end.gif
?????文件????????574??2007-11-23?03:37??test\images\logon_middle.gif
?????文件??????32680??2007-11-23?03:37??test\images\logon_top.gif
?????文件???????5677??2007-11-22?21:39??test\images\menu.gif
?????文件???????1111??2007-11-22?21:44??test\images\m_index.gif
............此處省略214個(gè)文件信息
評(píng)論
共有 條評(píng)論