*/
public ActionForward list1(ActionMapping actionMapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
try {
//UserContext user = QingZhiDispatchAction.threadLocal.get();
String strPageNO = (String) request.getParameter("pageNO");
int pageNO = strPageNO == null ? Integer.parseInt("1") : Integer.parseInt(strPageNO);
int listFlag = 1;
String islist = (String) request.getParameter("islist");
if(islist!=null && islist.trim().equals("0"))
listFlag = 0;
String prtid = (String)request.getParameter("prtid");
if(prtid==null||prtid.trim().equals("")) {
prtid = "";
}
YwlsxxFormBean ywlsxxForm = (YwlsxxFormBean)form;
PageInfo pi = new PageInfo();
HttpSession session = request.getSession(true);
QueryCondition qc = (QueryCondition) session.getAttribute(QueryCondition.QUERY_SESSION);
if(qc!=null && listFlag==0)
{
if(qc.getForm()!=null){
ywlsxxForm = (YwlsxxFormBean)qc.getForm();
}
if(qc.getPi()!=null)
{pi = qc.getPi();
}
}
else if(qc==null || listFlag==1)
{
String where = "";
String order = "order by id";
pi.setOrder(order);
String param = request.getParameter("bm");
if (!("").equals(param) && param != null)
{
where = "where bm='"+param+"'";
}
pi.setPageNO(pageNO);
pi.setWhere(where);
pi.setOrder(order);
ywlsxxFacade.addWhereClauseKey(ywlsxxForm,pi);
}
ywlsxxFacade.listAll(pi);
ywlsxxFacade.count(pi);
request.setAttribute("prtid", prtid);
request.setAttribute("pi", pi);
request.setAttribute( "form", ywlsxxForm );
if(qc==null){
qc = new QueryCondition();
}
qc.setForm(ywlsxxForm);
qc.setPi(pi);
session.setAttribute(QueryCondition.QUERY_SESSION,qc);
return actionMapping.findForward("list1");
} catch (Exception e) {
return (forwardErrorPage(request, actionMapping, ResourceReader.getMessageFromResource("error.wxjj.ywlsxx.search"),e));
}
}我用的是ssh框架,这是执行的action,第一次查询时从页面可以传过来bm值给param,在翻页时又调用这个方法,但bm已经没有值了,也就是说if (!("").equals(param) && param != null)不成立where = "where bm='"+param+"'";条件不能用了,所以就成了查询数据库表中所有数据的第二页了,大家看看改怎么办呢我要的结果是翻页还是按照有where条件的那个结果集翻到第二页