<jsp:useBean>问题
这个是报的错误
javax.servlet.jsp.el.ELException: Unable to find a value for "allRs" in object of class "dao.TwoDao" using operator "."-------------------------------------------------------------------
这个是我显示页面jsp的代码
<%@taglib prefix="c" uri="/WEB-INF/c.tld"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<jsp:useBean id="lst" class="dao.TwoDao" scope="page">
</jsp:useBean><c:set var="stus" value="${lst.allRs}">
</c:set><table>
<tr>
<th>二级标题</th>
<th>路径</th>
<th>ID</th>
<th>添加日期</th>
<th>一级标题</th>
<th>删除</th>
<th>修改</th>
</tr>
<c:forEach items="${stus}" var="a">
<tr>
<td>${a.onetitle }</td>
<td>${a.twotitle }</td>
<td>${a.path }</td>
<td>${a.uid }</td>
<td>${a.pubdate }</td>
<td></td>
<td></td>
</tr>
</c:forEach>
</table>-----------------------------------------------
这个是我dao包里面的TwoDao类的allRs方法public List allRs() throws Exception
{
String sql="select *from secondnews";
Data da=new Data();
ResultSet rs=da.getRS(sql);
List lis=new ArrayList();
while(rs.next())
{
String twotitle=rs.getString("twotitle");
String path=rs.getString("path");
int uid=rs.getInt("uid");
String pubdate=rs.getString("pubdate");
String onetitle=rs.getString("onetitle");
Twobean tb=new Twobean(onetitle,twotitle,path,uid,pubdate);
lis.add(tb);
}
return lis;
}-----------------------------------------------
这个是我的Twobean类package bean;public class Twobean {
private String onetitle;
private String twotitle;
private String path;
private int uid;
private String pubdate;
public Twobean(String onetitle, String twotitle, String path, int uid, String pubdate) {
super();
this.onetitle = onetitle;
this.twotitle = twotitle;
this.path = path;
this.uid = uid;
this.pubdate = pubdate;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getPubdate() {
return pubdate;
}
public void setPubdate(String pubdate) {
this.pubdate = pubdate;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getOnetitle() {
return onetitle;
}
public void setOnetitle(String onetitle) {
this.onetitle = onetitle;
}
public String getTwotitle() {
return twotitle;
}
public void setTwotitle(String twotitle) {
this.twotitle = twotitle;
}
}
请大家帮我看看到底是哪里错了谢谢了
这个是报的错误
javax.servlet.jsp.el.ELException: Unable to find a value for "allRs" in object of class "dao.TwoDao" using operator "."-------------------------------------------------------------------
这个是我显示页面jsp的代码
<%@taglib prefix="c" uri="/WEB-INF/c.tld"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<jsp:useBean id="lst" class="dao.TwoDao" scope="page">
</jsp:useBean><c:set var="stus" value="${lst.allRs}">
</c:set><table>
<tr>
<th>二级标题</th>
<th>路径</th>
<th>ID</th>
<th>添加日期</th>
<th>一级标题</th>
<th>删除</th>
<th>修改</th>
</tr>
<c:forEach items="${stus}" var="a">
<tr>
<td>${a.onetitle }</td>
<td>${a.twotitle }</td>
<td>${a.path }</td>
<td>${a.uid }</td>
<td>${a.pubdate }</td>
<td></td>
<td></td>
</tr>
</c:forEach>
</table>-----------------------------------------------
这个是我dao包里面的TwoDao类的allRs方法public List allRs() throws Exception
{
String sql="select *from secondnews";
Data da=new Data();
ResultSet rs=da.getRS(sql);
List lis=new ArrayList();
while(rs.next())
{
String twotitle=rs.getString("twotitle");
String path=rs.getString("path");
int uid=rs.getInt("uid");
String pubdate=rs.getString("pubdate");
String onetitle=rs.getString("onetitle");
Twobean tb=new Twobean(onetitle,twotitle,path,uid,pubdate);
lis.add(tb);
}
return lis;
}-----------------------------------------------
这个是我的Twobean类package bean;public class Twobean {
private String onetitle;
private String twotitle;
private String path;
private int uid;
private String pubdate;
public Twobean(String onetitle, String twotitle, String path, int uid, String pubdate) {
super();
this.onetitle = onetitle;
this.twotitle = twotitle;
this.path = path;
this.uid = uid;
this.pubdate = pubdate;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getPubdate() {
return pubdate;
}
public void setPubdate(String pubdate) {
this.pubdate = pubdate;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getOnetitle() {
return onetitle;
}
public void setOnetitle(String onetitle) {
this.onetitle = onetitle;
}
public String getTwotitle() {
return twotitle;
}
public void setTwotitle(String twotitle) {
this.twotitle = twotitle;
}
}
请大家帮我看看到底是哪里错了谢谢了
解决方案 »
- 那位高手帮我看下这个问题Cannot convert value of type [] to required type [] for property 'ba
- 奇怪的问题?拿分啦
- 知道对方有没有打开我用javamail发的邮件的方法?
- 请教一个方法。
- 新群开张!欢迎光临!
- 求大神看看这是什么错误,好纠结..!
- 一个servlet中能不能既输出文字格式又输出二进制格式
- 使用静态的sessionFactory,hibernate的session过期后。需要重启服务器,才能重新连接数据库。是什么原因。【急】
- 客户下载文件时我怎么要求客户强制经过用户名和密码认证
- 已经一天了,这个问题还未解决,实在郁闷,哪为大侠能帮帮我,解决后一定给100,谢谢
- MyEclipse6.0 连接数据库
- 关于一个商务网站的Servlet.service() for servlet jsp threw exception问题,请高手指点啊~~!!
用requset.set...('stus', 存入 Arlist list = allRs() );然后foreach 取 stus 把 usebean给取掉 就可以了