Was this part of the fix in WW-4427?

-----Original Message-----
From: CRANFORD, CHRIS [mailto:chris.cranf...@setech.com] 
Sent: Tuesday, April 28, 2015 8:30 AM
To: Struts Users Mailing List
Subject: RE: Problem using TypeConverters with SelectTag

Version 2.3.20 GA

-----Original Message-----
From: Lukasz Lenart [mailto:lukaszlen...@apache.org]
Sent: Tuesday, April 28, 2015 6:20 AM
To: Struts Users Mailing List
Subject: Re: Problem using TypeConverters with SelectTag

Struts version? I thought this was already resolved.

2015-04-24 15:16 GMT+02:00 CRANFORD, CHRIS <chris.cranf...@setech.com>:
> I have defined a simple POJO and type converter shown here:
>
> // Model POJO
> public class SiteSelection {
>                 private String type;
>                 private String label;
>                 private List<Long> ids = new ArrayList<Long>();
>                 /* getter & setters */ }
>
> // Converter
> public class SiteSelectionTypeConverter extends StrutsTypeConverter {
>                 @Override
>                 public Object convertFromString(Map context, String[] values, 
> Class toClass) {
>                                 /* converts values[0] from 
> '{type}:{comma-separted list of ids} */
>                 }
>                 @Override
>                 public String convertToString(Map context, Object object) {
>                                 /* converts object to string using format 
> '{type}:{comma-separated list of ids} */
>                 }
> }
>
> // Action
> public class SomeAction extends ActionSupport implements Preparable {
>                 private List<SiteSelection> siteSelections;
>                 private SiteSelection selectedSite;
>                 /* getter & setters */ }
>
> In the JSP, I have used the select tag as follows
>
> <s:select name="selectedSite" list="siteSelections" />
>
> The type converters get used and the select is populated with the appropriate 
> key/value pairs.   The problem is when I take a specific entry in the 
> siteSelections and set it on the selectedSite property during the initial 
> render or populate selectedSite and re-render the input page during say a 
> validation failure, the select tag doesn't apply the "selected" attribute on 
> any options.
>
> This seems to be an issue with how parameters.nameValue is being determined 
> in the taglib java code and the fact that the template compares this 
> parameter against itemKey rather than itemKeyStr.  In the case of using type 
> conversion, the itemKey is something like "com.app.SiteSelection@2b3a51e" 
> where as itemKeyStr is "A:1,2,3".
>
> Can someone explain to me what was the intended way to use 
> TypeConverter implementations with a select tag?  The only way I've 
> been able to hack around this issue is
>
> <s:set var="selectedSiteStr" value="selectedSite" /> <s:select 
> name="selectedSite" value="#selectedSiteStr" list="siteSelections"
> template="my-custom-select" />
>
> and modifying the select.ftl line 107 from:
>
> <#if tag.contains(parameters.nameValue, itemKey) == true>
>
> To:
>
> <#if tag.contains(parameters.nameValue, itemKeyStr) == true>
>
> But I'm not sure what side effects such a change would have.
>
> ___________________________________________________________
> Chris Cranford
> SAP/Oracle/J2EE Applications Developer SETECH Inc & Companies
> 903 Industrial Drive, Murfreesboro TN 37129
> Phone: (615) 890-1755 x361, Fax: (615) 890-9057, Mobile: (704)
> 650-1042
> Email: chris.cranf...@setech.com<mailto:chris.cranf...@setech.com>
>

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


Email secured by Check Point

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

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

Reply via email to