| 发表于:2007-07-18 17:31:304楼 得分:0 |
string sql_search = "select * from table "; request.getsession().setattribute( "sql_search ", sql_search); list list = db.select(sql_search, 10); if(!list.isempty()){ request.setattribute( "flag ", "yes "); } else{ request.setattribute( "flag ", "no "); } return new actionforward( "/search.jsp "); } ------------------------------------------------------------------- search.jsp: <logic:notempty name= "flag "> <logic:equal name= "flag " value= "yes "> <script> window.opener.location= 'selectall.do?action=selectall&name=one '; window.opener.alert( "查询成功! "); window.close(); </script> </logic:equal> <logic:equal name= "flag " value= "no "> <script> window.alert( "对不起,没有查到相关记录! "); window.history.go(-1); </script> </logic:equal> </logic:notempty> --------------------------------------------------------------------- selectall.do: public actionforward selectall() { string name = request.getparameter( "name "); if(name.equals( "all ")) { //查询所有 } if(name.equals( "one ")) //条件查询 { string sql = request.getsession().getattribute( "sql_search ").tostring(); list list = new db(ds).select(sql,10); //对list进行分页 } return new actionforward( "/list.jsp "); } | | |
|