没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
#### 带属性的标签
- 步骤:
- - 创建标签类;
- - 配置标签;
- - 设置标签属性,并使用:
- 示例代码:
```
package taglibclass;
import java.io.Writer;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
public class QueryTag extends SimpleTagSupport {
private String driver;
private String username;
private String password;
private String url;
private String sql;
private Connection connection = null;
private PreparedStatement ps = null;
private ResultSet rs = null;
private ResultSetMetaData rsmd = null;
public void doTag() {
try {
Class.forName(driver);
connection = DriverManager.getConnection(url, username, password);
ps = connection.prepareStatement(sql);
rs = ps.executeQuery();
rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
Writer out = getJspContext().getOut();
out.write("