javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property

只谈情不闲聊 提交于 2019-12-04 12:13:45

Maybe check your taglib import:

OLD

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

NEW

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 

Is your Product class and its getters accessible? By this I broadly mean are they public?

See http://forum.springsource.org/showthread.php?58420-Problem-with-javax.el.PropertyNotFoundException.

This happen when you are passing a String to an EL operation c:forEach instead of an iterable element, in the following example I miss the '$' so it's passing the exact String without variable resolution.

<c:forEach var="o" items="{operations}">

The next is right because operation is a String[] in my code

<c:forEach var="o" items="${operations}">

Try this:

<c:forEach items="${model['products']}" var="oneProduct">
    <c:out value="${oneProduct.description}"/> <i>$<c:out value="${oneProduct.price}"/>                            
    </i><br><br>
</c:forEach>

And check the capitalization of you gettters and setters, should be getDescription()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!