Closed GoogleCodeExporter closed 9 years ago
Original comment by johgep
on 12 Mar 2010 at 4:28
I just try it out, but can't reproduced this problems.
I add following code to the JsonSample Class in the Showcase
private Map<Integer, String> countryMap;
public String execute() {
countryMap = new HashMap<Integer, String>();
countryMap.put(35, "TURKEY");
countryMap.put(36, "UKRAINE");
countryMap.put(33, "ROMANIA");
countryMap.put(34, "TEST COUNTRY");
countryMap.put(39, "UK SAT");
countryMap.put(37, "COLOMBIA");
countryMap.put(38, "CHILE");
return SUCCESS;
}
public String getJSON() {
return execute();
}
public Map<Integer, String> getCountryMap() {
return countryMap;
}
and this jsp code:
<s:url id="remoteurl" action="jsonsample"/>
<sj:select
href="%{remoteurl}"
id="echo0"
name="echo"
list="countryMap"
emptyOption="true"
headerKey="-1"
headerValue="Please Select a Country"
/>
do you have this problem only in a special browser?
Original comment by johgep
on 15 Mar 2010 at 6:53
did it work with version 2.0.0?
Original comment by johgep
on 9 Apr 2010 at 9:29
No - problem still occurs - exactly as described.
I am working around this problem by using Map<String, String> and prefixing int
with
i. Not ideal but fine.
Did you receive my email with simpler Action class to reproduce error? (I have
attached to this comment anyway....)
Action class:
import com.opensymphony.xwork2.ActionSupport;
import java.util.HashMap;
import java.util.Map;
public class CountrySelect extends ActionSupport {
private Map<Integer, String> countryMap;
@Override
public String execute() {
countryMap = new HashMap<Integer, String>();
int count = 1;
do {
countryMap.put(count++, "hey");
} while(count!=5);
return SUCCESS;
}
public String getJSON() {
return execute();
}
public Map<Integer, String> getCountryMap() {
return countryMap;
}
}
Produces:
<select name="country" id="country">
<option value="-1">Select a country</option><option></option><option
value="1">hey</option><option value="hey">hey</option><option
value="hey">hey</option><option value="hey">hey</option></select>
Original comment by mryan...@gmail.com
on 13 Apr 2010 at 2:29
Just to reconfirm this problem still occurs. Tested again after browser issues
with
version update. Reference ticket #136
Original comment by mryan...@gmail.com
on 14 Apr 2010 at 10:13
Original comment by johgep
on 2 Jun 2010 at 2:58
I have the same sort of thing happening that really seems identical to this
whole problem. My list only contains a few items; however, as you can see from
the example below, the first 3 options are invalid. The values should be
numeric values and not their textual counterpart:
<span id="wwctrl_facilityType" class="wwctrl">
<select name="facilityType" id="facilityType">
<option value="Unknown">
Unknown
</option>
<option value="DOC">
DOC
</option>
<option value="Jails">
Jails
</option>
<option value="-100">
DOC and Jails
</option>
<option value="6">
Courts
</option>
<option value="24">
Probation & Parole
</option>
</select>
</span>
Original comment by dustf...@gmail.com
on 28 Jun 2010 at 4:26
@dustfrog
can you give me please some code examples?
Which version of this plugin do you use?
Original comment by johgep
on 6 Jul 2010 at 2:42
Sure, no problem. This is the code from my Facility.tag file:
<%@ include file="/WEB-INF/includes/taglibs.jsp" %>
<s:set name="key" value="getText('report.facility.type')" />
<span class="topLabel">
<s:url id="facility_url" action="ajaxFacilityListing"
namespace="/actions"></s:url>
<sj:select href="%{facility_url}"
name="facilityType"
label="%{key}"
labelposition="left"
list="facilities"
value="-100"
onAlwaysTopics="updateAgencyList"
onChangeTopics="updateAgencyList"
/>
</span>
The list="facilities" is calling a getFacilities() method from the action which
returns Map<Integer, String>. I used HttpFox to verify the JSON content being
returned, and the data was correct; however, it just was not being displayed
correctly through sj:select.
I was using 2.1.0, but I found this problem to still exist in 2.2.2.
Hope this helps.
Original comment by dustf...@gmail.com
on 8 Jul 2010 at 3:59
I was able to reproduce this error. It was a wrong detection if value list is a
map.
This is fixed with next version.
http://code.google.com/p/struts2-jquery/source/detail?r=1125
Original comment by johgep
on 13 Jul 2010 at 7:35
Great! Thanks for looking into the problem.
Original comment by dustf...@gmail.com
on 14 Jul 2010 at 6:24
Original comment by johgep
on 25 Jul 2010 at 6:53
Original issue reported on code.google.com by
mryan...@gmail.com
on 12 Mar 2010 at 12:51