struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DavidCAIT <dzaze...@cait.org>
Subject Null element in List<Integer>
Date Tue, 03 Feb 2009 16:10:50 GMT

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:
>> ----------
>>==&gt; 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-tp21812998p21812998.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message