Websphere 7 和 Websphere 7 JSTL:无法从数组获取值 -> EL 实现中缺少资源:???propertyNotReadable?
自从从 WAS6.1 升级到 WAS7.0 以来,我在尝试显示数组中包含的值时遇到错误。
Java:
private Date[] days = new Date[10];
public Date[] getDays() {
return days;
}
JSP:
<td><fmt:formatDate value="${fair.days[0]}" pattern="dd.MM.yyyy" /><td>
这会导致以下错误:
[Exception in:/tilesContent/listFairs_bodyarea.jsp] Missing Resource in EL
implementation: ???propertyNotReadable???
我的应用程序在部署到 WAS6.1 服务器时工作正常。该问题仅出现在 WAS7 上。
我添加了一个 getFirstDay() 方法,该方法返回 days[0] 并使用 ${fair.firstDay} 访问它,这有效。访问数组有问题吗?
Since upgrading from WAS6.1 to WAS7.0 I'm getting an error when trying to display a value contained in an array.
Java:
private Date[] days = new Date[10];
public Date[] getDays() {
return days;
}
JSP:
<td><fmt:formatDate value="${fair.days[0]}" pattern="dd.MM.yyyy" /><td>
This causes the following error:
[Exception in:/tilesContent/listFairs_bodyarea.jsp] Missing Resource in EL
implementation: ???propertyNotReadable???
My application works fine when deployed to a WAS6.1 server. The problem only occurs on WAS7.
I added a getFirstDay() method which returns days[0] and accessed it using ${fair.firstDay} and this works. Is there a problem accessing arrays?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想我已经找到了该问题的部分解释和解决方法。
我向 Fair 类添加了一个新的索引属性来检查索引
属性工作正常。他们确实这么做了。
我为 days 数组添加了一个新的 getter,并将其命名为 getXyz()。效果很好。
我注意到原来的 getter 和 setter 是不对称的(歇斯底里的原因)。
我知道这有点奇怪,但到目前为止一直有效。无论如何,我修改了
方法如下:
问题不再出现。
我没有解释为什么这可以解决问题,因为我认为只使用了吸气剂。这个“解决方案”对我来说没问题,因为代码看起来更好并且有效。
(如果您知道为什么这可以解决问题,请随时添加评论)
I think I have found an partial explanation and a work-around for the problem.
I added a new indexed property to the Fair class to check that indexed
properties work ok. They do.
I added a new getter for the days array and gave it the name getXyz(). That worked ok.
I noticed that the original getter and setter were asymetrical (hysterical reasons).
I know this is a bit wierd but it worked up til now. Anyway, I modified
the methods as follows:
The problem no longer occurs.
I have no explaination for why this fixes the problem as I think that only the getter is being used. This 'solution' is ok for me as the code looks better and it works.
(Feel free to add a comment if you know WHY this solves the problem)
实际上还有另一个问题:在使用的 EL 实现中找不到实际的异常消息。这表明您的类路径中有另一种旧版本的 EL 实现,它与应用程序服务器提供的实现发生冲突。
确保 web 应用程序的
/WEB-INF/lib
中没有任何特定于一台服务器的 JAR 文件。清理该文件夹以删除任何特定于服务器的 JAR 文件。There's actually another problem: the actual exception message cannot be found in the EL implementation used. This indicates that you've another, older versioned, EL implementation in your classpath which is colliding with the one supplied by the applicationserver.
Ensure that you don't have any JAR files in webapp's
/WEB-INF/lib
which are specific to one server. Clean up the folder to get rid of any server-specific JAR files.