webwork分页例子含JSPXMLaction.docx
《webwork分页例子含JSPXMLaction.docx》由会员分享,可在线阅读,更多相关《webwork分页例子含JSPXMLaction.docx(53页珍藏版)》请在冰豆网上搜索。
webwork分页例子含JSPXMLaction
1.JAVA
1.1FORM
packagelan;
importjava.util.List;
importcom.nl.bss.form.BVBaseForm;
publicclassYardConfigFormextendsBVBaseForm{
privateStringschoolName;
privateStringschoolCode;
privateStringm_operator_id;//修改的操作员
privateStringUSE_FLAG;
privateStringmodifyDate;
privateStringoperator_id;//原操作员
privateStringchangedate;//修改时间
privateStringappDate;
privateStringx_Code;//小区代码
privateStringx_Name;//小区名
privateStringyardName;//校区名称
privateStringyardCode;//校区代码
privateintcurrentPage=1;//当前页
publicStringgetYardName(){
returnyardName;
}
publicvoidsetYardName(StringyardName){
this.yardName=yardName;
}
publicStringgetYardCode(){
returnyardCode;
}
publicvoidsetYardCode(StringyardCode){
this.yardCode=yardCode;
}
publicStringgetAppDate(){
returnappDate;
}
publicvoidsetAppDate(StringappDate){
this.appDate=appDate;
}
publicStringgetChangedate(){
returnchangedate;
}
publicvoidsetChangedate(Stringchangedate){
this.changedate=changedate;
}
publicStringgetOperator_id(){
returnoperator_id;
}
publicvoidsetOperator_id(Stringoperator_id){
this.operator_id=operator_id;
}
publicStringgetModifyDate(){
returnmodifyDate;
}
publicvoidsetModifyDate(StringmodifyDate){
this.modifyDate=modifyDate;
}
publicStringgetSchoolName(){
returnschoolName;
}
publicvoidsetSchoolName(StringschoolName){
this.schoolName=schoolName;
}
publicStringgetSchoolCode(){
returnschoolCode;
}
publicvoidsetSchoolCode(StringschoolCode){
this.schoolCode=schoolCode;
}
publicStringgetM_operator_id(){
returnm_operator_id;
}
publicvoidsetM_operator_id(Stringm_operator_id){
this.m_operator_id=m_operator_id;
}
publicStringgetUSE_FLAG(){
returnUSE_FLAG;
}
publicvoidsetUSE_FLAG(Stringuse_flag){
USE_FLAG=use_flag;
}
publicvoidreset(){
schoolName="";
schoolCode="";
m_operator_id="";
USE_FLAG="";
modifyDate="";
operator_id="";
x_Code="";
x_Name="";
yardName="";
yardCode="";
}
publicStringgetX_Code(){
returnx_Code;
}
publicvoidsetX_Code(Stringcode){
x_Code=code;
}
publicStringgetX_Name(){
returnx_Name;
}
publicvoidsetX_Name(Stringname){
x_Name=name;
}
publicintgetCurrentPage(){
returncurrentPage;
}
publicvoidsetCurrentPage(intcurrentPage){
this.currentPage=currentPage;
}
}
1.2ACTION
javaAction:
packagelan;
importjava.math.BigDecimal;
importjava.sql.Timestamp;
importjava.text.SimpleDateFormat;
importjava.util.ArrayList;
importjava.util.Date;
importjava.util.Iterator;
importjava.util.List;
importjava.util.Map;
importjavax.servlet.http.HttpSession;
importwebss.utils.WEBSSUtil;
importbiz_management.global.Operator_DT;
importcom.nl.base.utils.DBTools;
importcom.nl.bss.action.BVBaseAction;
importcom.nl.bss.mgmt.BVBaseService;
importcom.nl.bss.utils.GlobalConst;
importcom.opensymphony.webwork.ServletActionContext;
importcom.opensymphony.xwork.ActionContext;
importcom.opensymphony.xwork.ModelDriven;
publicclassYardConfigActionextendsBVBaseActionimplementsModelDriven{
privateBVBaseServiceservice;
privateYardConfigFormform;
privateListRList;
publicListgetRList(){
returnRList;
}
publicvoidsetRList(Listlist){
RList=list;
}
publicYardConfigFormgetForm(){
returnform;
}
publicvoidsetForm(YardConfigFormform){
this.form=form;
}
/**
*@returntheservice
*/
publicBVBaseServicegetService(){
returnservice;
}
/**
*@paramservice
*theservicetoset
*/
publicvoidsetService(BVBaseServiceservice){
this.service=service;
}
publicStringpage_init()throwsException{
//从session中取出地市号
try{
form.reset();
returnthis.showYard();
}catch(Exceptione){
//TODOAuto-generatedcatchblock
form.setErrorMessage("系统忙,请稍候再试!
");
return"fail";
}
}
/*
*(non-Javadoc)
*
*@seecom.opensymphony.xwork.ActionSupport#execute()
*/
publicStringshowYard()throwsException{
//从session中取出地市编号
try{
HttpSessionsession=ServletActionContext.getRequest().getSession();
Operator_DToperatorInfo=(Operator_DT)session
.getAttribute("operatorInfo");
intcityId=operatorInfo.city_id;
intcountryId=operatorInfo.county_id;
this.args.put(GlobalConst.KEY_IS_LOG,"true");//设置是否需要写日志
this.args.put(GlobalConst.KEY_PAGE_METHOD,"showSum");//操作方法决定SC需要调用的方法
this.args.put("CITYID",cityId+"");
this.args.put("COUNTRYID",countryId+"");
this.args.put("NAME",form.getSchoolName());
this.args.put("CODE",form.getSchoolCode());
this.args.put("YARDCODE",form.getYardCode());
this.args.put("YARDNAM