MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » JSP条件查询翻页有关问题

JSP条件查询翻页有关问题(2)

www.MyException.Cn  网友分享于:2013-12-11  浏览:1651次

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 ");
}

以上是我最近一次练习时使用的,传sql语句的,用起来还可以,我在另一个帖子里也发过
------解决方案--------------------
我正在用的:

<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.*,com.v246.sql.*,com.v246.utils.*,java.util.*,com.v246.* " errorPage= " " %>
<%
String thisPageName = request.getRequestURI();
thisPageName = thisPageName.substring(thisPageName.lastIndexOf( "/ ")+1,thisPageName.length());
String type = request.getParameter( "type ");
String disPageName=(Aqu.vacancy(type))?thisPageName+ "? ":thisPageName+ "?type= "+type+ "& ";
Session sessions = new Session();

//分页
Pagination p = sessions.createPagination();//创建用于分页的类
String pageTmp = request.getParameter( "page ");
int pages = 1;
if(!Aqu.vacancy(pageTmp))
{
pages = Integer.parseInt(pageTmp);
}
p.setDisCount(15);//设置分页大小
p.setTable(ArticleConst.infoTable);//设置分页的表
p.setPrimaryKey( "id ");
p.setOrder(Const.desc);
if(!Aqu.vacancy(type))
{
p.setTerm( "type= "+type);
}
ResultSet rs = p.gotoPage(pages);
%>

<html>
<script language= "Javascript1.2 ">
<!-- // load htmlarea
_editor_url = "editor/ "; // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split( "MSIE ")[1]);
if (navigator.userAgent.indexOf( 'Mac ') > = 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf( 'Windows CE ') > = 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf( 'Opera ') > = 0) { win_ie_ver = 0; }
if (win_ie_ver > = 5.5) {
document.write( ' <scr ' + 'ipt src= " ' +_editor_url+ 'editor.js " ');
document.write( ' language= "Javascript1.2 "> </scr ' + 'ipt> ');
} else { document.write( ' <scr '+ 'ipt> function editor_generate() { return false; } </scr '+ 'ipt> '); }
// -->
</script>
<head>

<script language 'javascript '>
function go(type)
{
window.location.href= " <%=thisPageName%> ?type= "+type;
//alert( " <%=thisPageName%> ?type= "+type);

}
</script>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 健康生活管理 </title>
<link href= "../css/style.css " rel= "stylesheet " type= "text/css ">
<style type= "text/css ">

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有