You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bhaarat Sharma <bh...@gmail.com> on 2009/04/16 15:45:44 UTC

Struts2 select tag with multiple enabled

I am using a select tag like this

<s:select multiple="true"  headerKey="-1" list="rejectionReasons"
value="%{fmrTenant.terminationReason}" required="true"/>

list = "rejectionReasons"

invokes the following method:

    public List getRejectionReasons() {
        return rejectionReasons;
    }

I am using value="%{fmrTenant.terminationReason}" because I want to preselec
some of the values returned. this invokes the following method

    public String[] getTerminationReason() {
        return terminationReason;
    }

I am getting the following error
Expected number, date, or string. parameters.nameValue evaluated instead to
freemarker.ext.beans.ArrayModel on line 60, column 101 in
template/simple/select.ftl.
The problematic instruction:
----------
==> if tag.contains(parameters.nameValue, itemKey) == true ||
(parameters.nameValue?exists && parameters.nameValue?string == itemKey) [on
line 60, column 9 in template/simple/select.ftl]
 in user-directive s.iterator [on line 40, column 1 in
template/simple/select.ftl]
----------


I looked for this error online and seems like this is a bug in struts2:
https://issues.apache.org/struts/browse/WW-1747

I just wanted to make sure whether there is a work around as to how I am
trying to do this?

Thanks!

Re: Struts2 select tag with multiple enabled

Posted by Terry Gardner <Te...@Sun.COM>.
fmrTenant.getTerminationReason should return a String, not an array?

On a different subject, consider using generics:

public List<String> getRejectionReasons() { return  
this.rejectionReasons; }
private List<String> rejectionReasons;

On Apr 16, 2009, at 9:45 AM, Bhaarat Sharma wrote:

> I am using a select tag like this
>
> <s:select multiple="true"  headerKey="-1" list="rejectionReasons"
> value="%{fmrTenant.terminationReason}" required="true"/>
>
> list = "rejectionReasons"
>
> invokes the following method:
>
>    public List getRejectionReasons() {
>        return rejectionReasons;
>    }
>
> I am using value="%{fmrTenant.terminationReason}" because I want to  
> preselec
> some of the values returned. this invokes the following method
>
>    public String[] getTerminationReason() {
>        return terminationReason;
>    }
>
> I am getting the following error
> Expected number, date, or string. parameters.nameValue evaluated  
> instead to
> freemarker.ext.beans.ArrayModel on line 60, column 101 in
> template/simple/select.ftl.
> The problematic instruction:
> ----------
> ==> if tag.contains(parameters.nameValue, itemKey) == true ||
> (parameters.nameValue?exists && parameters.nameValue?string ==  
> itemKey) [on
> line 60, column 9 in template/simple/select.ftl]
> in user-directive s.iterator [on line 40, column 1 in
> template/simple/select.ftl]
> ----------
>
>
> I looked for this error online and seems like this is a bug in  
> struts2:
> https://issues.apache.org/struts/browse/WW-1747
>
> I just wanted to make sure whether there is a work around as to how  
> I am
> trying to do this?
>
> Thanks!


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


Re: Struts2 select tag with multiple enabled

Posted by Felipe Lorenz <fe...@gmail.com>.
Im not sure. but i think you need to add the attribute "name".
i.e.:  <s:select multiple="true"  headerKey="-1" list="rejectionReasons"
value="%{fmrTenant.terminationReason}" required="true" name="something" />

On Thu, Apr 16, 2009 at 10:45 AM, Bhaarat Sharma <bh...@gmail.com>wrote:

> I am using a select tag like this
>
> <s:select multiple="true"  headerKey="-1" list="rejectionReasons"
> value="%{fmrTenant.terminationReason}" required="true"/>
>
> list = "rejectionReasons"
>
> invokes the following method:
>
>    public List getRejectionReasons() {
>        return rejectionReasons;
>    }
>
> I am using value="%{fmrTenant.terminationReason}" because I want to
> preselec
> some of the values returned. this invokes the following method
>
>    public String[] getTerminationReason() {
>        return terminationReason;
>    }
>
> I am getting the following error
> Expected number, date, or string. parameters.nameValue evaluated instead to
> freemarker.ext.beans.ArrayModel on line 60, column 101 in
> template/simple/select.ftl.
> The problematic instruction:
> ----------
> ==> if tag.contains(parameters.nameValue, itemKey) == true ||
> (parameters.nameValue?exists && parameters.nameValue?string == itemKey) [on
> line 60, column 9 in template/simple/select.ftl]
>  in user-directive s.iterator [on line 40, column 1 in
> template/simple/select.ftl]
> ----------
>
>
> I looked for this error online and seems like this is a bug in struts2:
> https://issues.apache.org/struts/browse/WW-1747
>
> I just wanted to make sure whether there is a work around as to how I am
> trying to do this?
>
> Thanks!
>



-- 
Felipe A. Lorenz
Idealogic Software
http://www.idealogic.com.br