I did find a workaround which is a bit undesirable.
If I change my ArrayList to a TreeMap and store the same value for the key
and the value then the problem disappears. However, it is a bit wasteful to
store each value in the list twice.
Any other ideas? If not, my workaround is good enough for me.............
DavidCAIT wrote:
>
> Hi,
>
> I have a list of Integers and I want one of the options to be null (since
> it is a search field). However, I get the following freemarker exception
> when rendering my JSP:
>
>>> FreeMarker template error!
>
>>> Error on line 73, column 13 in template/simple/select.ftl
>>> stack.findValue('top') is undefined.
>>> It cannot be assigned to itemKey
>>> The problematic instruction:
>>> ----------
>>>==> assignment: itemKey=stack.findValue('top') [on line 73, column 13
in template/simple/select.ftl]
>>> in user-directive s.iterator [on line 63, column 1 in
>>> template/simple/select.ftl]
>>> ----------
>
> I am using Struts 2.0.11 with the following action:
>
> public class simpleAction implements Preparable {
>
> // both myList and value have a public getter and setter
> private List<Integer> myList = new ArrayList<Integer>();
> private Integer value;
>
> public String prepare() {
>
> myList.add(null); // commenting out this line removes the runtime JSP
> exception
> for (int i = 0; i < 60; i++) {
> myList.add(i);
> } } }
>
> My JSP page:
>
> <html>
> <body>
> <s:form action="anotherAction">
> <s:select list="myList" />
> <s:submit />
> </s:form>
> </body></html>
>
> Does anyone have any ideas or workarounds about how I can include a null
> entry in a list of integers without getting this freemarker exception?
> Thanks,
>
> David
>
--
View this message in context:
http://www.nabble.com/Null-element-in-List%3CInteger%3E-tp21812998p21813376.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]