Is there an easy way for a scriptlet to access a field from a result as below? What should it look like?
${item.options} is not written as <%= pageContext.getAttribute("item.options") %>
I know I can set a new pageContext variable and access that. But I thought there might be a more elegant way…
I know that scriptlets are not ideal, but I am just prototyping.
It’s
PageContext#findAttribute()and you should get the${item}directly instead of itsoptionsproperty which is not stored as a separate attribute or something. Given that it’s an instance of classItem, here’s how you can get it:Then just call the
getOptions()method on it.See also: