当前位置: 技术问答>java相关
数据查询导行条的问题。
来源: 互联网 发布时间:2015-07-27
本文导语: import java.io.*; import java.sql.*; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; public class navigator extends TagSupport { public int doEndTag() throws JspException { ConnectTag connectTag = (ConnectTag) findAncestorWithClass(this, Connect...
import java.io.*;
import java.sql.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class navigator extends TagSupport
{
public int doEndTag() throws JspException
{
ConnectTag connectTag = (ConnectTag)
findAncestorWithClass(this, ConnectTag.class);
if (connectTag == null)
throw new JspException("navigator must be in the body of a connect tag");
ResultSet rs = connectTag.getResultSet();
if (rs == null)
throw new JspException("No result set exists - no query has been run");
try
{
int i=rs.getRow();
JspWriter out = pageContext.getOut();
out.println("");
out.println("");
out.println("首 页");
out.println("上一页");
out.println("下一页");
out.println("尾 页");
out.println("");
out.println("");
}
catch(Exception e)
{
throw new JspException(e.getMessage());
}
return SKIP_BODY;
}
}
问怎样得到当前的URL;
还有查询已经执行,并且有返回的记录,但是i为0。
import java.sql.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class navigator extends TagSupport
{
public int doEndTag() throws JspException
{
ConnectTag connectTag = (ConnectTag)
findAncestorWithClass(this, ConnectTag.class);
if (connectTag == null)
throw new JspException("navigator must be in the body of a connect tag");
ResultSet rs = connectTag.getResultSet();
if (rs == null)
throw new JspException("No result set exists - no query has been run");
try
{
int i=rs.getRow();
JspWriter out = pageContext.getOut();
out.println("");
out.println("");
out.println("首 页");
out.println("上一页");
out.println("下一页");
out.println("尾 页");
out.println("");
out.println("");
}
catch(Exception e)
{
throw new JspException(e.getMessage());
}
return SKIP_BODY;
}
}
问怎样得到当前的URL;
还有查询已经执行,并且有返回的记录,但是i为0。
|
用int i=rs.getRows();试一下又没有