自己刚做了一个 tld 分页标签,在点击下一页的时候,我已经调用后台action方法,得到了下一页的数据,可问题是,我的页面没有重新绘制,不知道是什么情况;我的tag后台处理如下:[code="java"]
public class SelectTag extends TagSupport
{
private String urlStr;// 服务地址
private String parms;// 参数
private SelectBean selectBean;// 返回数据
private boolean hand = false;// 是否允许手动输入
private String cssClass;// 样式
@Override
public int doStartTag() throws JspException
{
return EVAL_BODY_INCLUDE;
}
@Override
public int doEndTag() throws JspException
{
try
{
JspWriter out = pageContext.getOut();
StringBuffer total = new StringBuffer("<div class=\"" + cssClass + "\">");
drawSelect(total);
total.append("<div id=\"listDIV\" class=\"list\">");
total.append("<table>");
total.append(drawList());
total.append("</table>");
total.append("</div>");
total.append("</div>");
out.print(total.toString());
}
catch (IOException e)
{
e.printStackTrace();
}
return EVAL_PAGE;
}
@Override
public int doAfterBody() throws JspException
{
return super.doAfterBody();
}
/**
* 绘制select
* @param total
*
*/
private void drawSelect(StringBuffer total)
{
total.append("<div>");
total.append("<input type=\"text\" name=\"Condition\" class=\"condition\" />");
total.append("<input type=\"Button\" value=\"查询\" class=\"search\" onclick=\"search();\" />");
total.append("</div>");
}
/**
* 绘制显示列表
*
* @param total
*
*/
private String drawList()
{
StringBuffer innerTotalBuffer = new StringBuffer("");
if (null != selectBean)
{
String zsnd = null;
for (int i = 0; i < selectBean.getObjs().size(); i++)
{
zsnd = selectBean.getObjs().get(i).get("ZSND") + "";
if (null == zsnd || zsnd.equals("null")) continue;
innerTotalBuffer.append("<tr><td>");
innerTotalBuffer.append(selectBean.getObjs().get(i).get("ZSND"));
innerTotalBuffer.append("</td></tr>");
}
}
return innerTotalBuffer.toString();
}
/* ======================数据封装========================== */
public String getParms()
{
return parms;
}
public void setParms(String parms)
{
this.parms = parms;
}
public SelectBean getSelectBean()
{
return selectBean;
}
public void setSelectBean(SelectBean selectBean)
{
this.selectBean = selectBean;
}
public String getCssClass()
{
return cssClass;
}
public void setCssClass(String cssClass)
{
this.cssClass = cssClass;
}
public boolean isHand()
{
return hand;
}
public void setHand(boolean hand)
{
this.hand = hand;
}
public String getUrlStr()
{
return urlStr;
}
public void setUrlStr(String urlStr)
{
this.urlStr = urlStr;
}
}
[/code]