<sql:query id="eventsForDay" connection="con">
---》
这句话要求标签中要有一个为connection的属性设值的方法,即setConnection(String)
---》
这句话要求标签中要有一个为connection的属性设值的方法,即setConnection(String)
解决方案 »
- 64位 03系统 和 32位,对js的影响大吗?
- DetachedCriteria 的Expression.in
- java web开发中的控件动态创建
- 如何放置媒体文件所在的的层?
- 高分求iPlanet Application Server的下载地址!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 想把自已的机器用来做JSP的服务器,具体怎么做?
- 菜鸟问题,请各位进来.
- 用尽的 Resultset!这个错误是怎么引起的?
- 什么是CRM
- Struts2处理一个form多个submit的问题
- 问个简单的问题:用JSP如何做出漂亮的网页啊?
- 我的jsp+javaBean+tomcat有问题
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;public class QueryTagHandler extends BodyTagSupport { protected Connection con = null;public int doAfterBody() throws JspException { try { String query = getBodyContent().getString(); System.out.println("[QueryTagHandler] doAfterBody, Query Body-> " + getBodyContent().getString()); Statement stmt = getConnection().createStatement(); ResultSet rs = stmt.executeQuery(query); this.pageContext.setAttribute(getId(), rs, pageContext.PAGE_SCOPE); } catch (Exception exc) { throw new JspException(exc.getMessage()); } return SKIP_BODY;}public Connection getConnection() { return con;}
public void setConnection(String newConnection) throws JspException{try { System.out.println("[QueryTagHandler] setConnection, Attribute-> " + newConnection); con = (Connection) pageContext.getAttribute(newConnection);
System.out.println("[QueryTagHandler] Connection : " + con); } catch (Exception exc) { throw new JspException(exc.getMessage()); }}}有setConnection(String)方法,为什么还是同样错误?!!!!!