小编Mr *_*gan的帖子

javax.el.PropertyNotFoundException:在JSP中使用JSTL

我有一个JSP,我正在尝试使用JSTL标记来显示类的内存实例中的数据.数据由一系列字符串组成,其中每个字符串是RSS提要的地址.

在JSP中,我有以下代码:

<table border = "1">
    <tr>
        <c:forEach var = "rssFeedURL" items = "${rssfom.rssFeedURLs}">
            <td align = "left">${rssFeedURL}</td>
        </c:forEach>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

基本上,rssfom是以下类的实例:

public class RSSFeedOccurrenceMiner extends RSSFeedMiner {

   private HashMap<String, Counter> keywordFrequencies;

   public RSS_Feed_OccurrenceMiner() {
      super();
      this.keywordFrequencies = new HashMap();
   }
   ...
}
Run Code Online (Sandbox Code Playgroud)

这继承自RSSFeedMiner类,它包含以下变量和方法:

private ArrayList<String> rssFeedURLs;

public ArrayList<String> getRSSFeedURLs() {
    return rssFeedURLs;
}

public void setRSSFeedURLs(ArrayList<String> rssFeedURLs) {
    this.rssFeedURLs = rssFeedURLs;
}
Run Code Online (Sandbox Code Playgroud)

所以在JSP中,我以为我可以使用上面的代码但是当页面运行时,我只是收到一个空表.在服务器日志中,我倾向于找到消息:

javax.el.PropertyNotFoundException:在类型RSSFeedOccurrenceMiner上找不到属性'rssFeedURLs'

鉴于我对继承的使用,这是正确的.那么有人能告诉我JSTL是否允许继承或者我的代码中是否缺少某些内容?

我真的不想在JSP中使用scriptlet.

jsp jstl el propertynotfoundexception

10
推荐指数
2
解决办法
2万
查看次数

标签 统计

el ×1

jsp ×1

jstl ×1

propertynotfoundexception ×1