📄 queryclientaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.gensou.struts.sheji.client.action;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.gensou.struts.sheji.client.form.QueryclientForm;
import com.gensou.util.PagesMax;
import com.gensou.util.Pagination;
import com.gensou.dao.sheji.client.*;
/**
* MyEclipse Struts
* Creation date: 01-10-2007
*
* XDoclet definition:
* @struts.action path="/queryclient" name="queryclientForm" scope="request" validate="true"
*/
public class QueryclientAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
QueryclientForm queryclientForm = (QueryclientForm) form;// TODO Auto-generated method stub
String query =null;
String pages=request.getParameter("pageS");
int pagei=Integer.parseInt(pages);
String hql;
int maxpage=1;
Clientdao clientdao=new Clientdao();
List list=new ArrayList();
try{
query=queryclientForm.getClientName();
if(query==null||query.equals("")){
query=(String)request.getParameter("query");
if(query==null||query.equals("")){
query="";
hql="select count(id) from Client";
maxpage=PagesMax.max(hql);
list=clientdao.queryclient(query,pagei,maxpage);
}
}else{
hql="select count(id) from Client where clientName like '%"+query+"%'";
maxpage=PagesMax.max(hql);
list=clientdao.queryclient(query,pagei,maxpage);
}
}catch(NullPointerException e){}
if(list.isEmpty()){
String str="该客户不存在";
request.setAttribute("str", str);
return mapping.findForward("queryclient");
}else{
request.setAttribute("query",query);
request.setAttribute("pageS",pagei+"");
request.setAttribute("maxpages",maxpage+"");
request.setAttribute("client_info", list);
return mapping.findForward("queryclient");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -