Results 1 to 5 of 5

Thread: <form:checkbox/> BUG when 1 digit map key

  1. #1
    Join Date
    Oct 2008
    Posts
    286

    Default <form:checkbox/> BUG when 1 digit map key

    Here's the jsp code:
    Code:
    <c:forEach var="entry" items="${viewObj.mapObj.itemMap}"
    	varStatus="status">
    	<c:set var="linkId" value="${entry.key}"></c:set>
    	<c:set var="item" value="${entry.value}"></c:set>
    	<tr>
    		<td><form:checkbox
    			title="${linkId}"
    			path="currentItemMap['${linkId}']" value="1"/></td>
    		<td>
    		${item.attrNo}</td>
    	</tr>
    </c:forEach>
    Here's the generated html code:
    Code:
    <tr>
    	<td>
    		<input type="checkbox" value="1" title="2" name="mapObj.currentItemMap['2']" id="mapObj.currentItemMap['2']1">
    		<input type="hidden" value="on" name="_mapObj.currentItemMap['2']"></td>
    	<td>
    		8316M0680</td>
    </tr>
    <tr>
    	<td>
    		<input type="checkbox" value="1" title="1" name="mapObj.currentItemMap['1']" id="mapObj.currentItemMap['1']1">
    		<input type="hidden" value="on" name="_mapObj.currentItemMap['1']"></td>
    	<td>
    		8317M0770</td>
    </tr>
    <tr>
    	<td>
    		<input type="checkbox" checked="checked" value="1" title="12" name="mapObj.currentItemMap['12']" id="mapObj.currentItemMap['12']1">
    		<input type="hidden" value="on" name="_mapObj.currentItemMap['12']"></td>
    	<td>
    		8308M0150</td>
    </tr>
    Here's the mapObj.currentItemMap actual data: KEY/VALUE pairs
    Code:
    {2=1, 1=1, 12=1}
    Findings:
    the three (3) checkboxes must be checked but only the last one was checked.

    the only difference of the checkboxes are thier KEY.

    1st checkbox KEY is '2' (which is one digit)
    2nd checkbox KEY is '1' (which is one digit)
    3rd checkbox KEY is '12' (which is two digit)

    Anyone encountered the same problem? this is very easy to reproduce. Just provide a Map<String, String> in your jsp which the KEYs are one (1) digit.
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

  2. #2
    Join Date
    Oct 2008
    Posts
    286

    Default not only one (1) digit, rather if one (1) character as KEY

    i tried the below case.

    Here's the mapObj.currentItemMap actual data:
    Code:
    {a=1, aa=1}
    Here's the generated html code:
    Code:
    <tr>
    	<td>
    		<input type="checkbox" value="1" title="a" name="mapObj.currentItemMap['a']" id="mapObj.currentItemMap['a']1">
    		<input type="hidden" value="on" name="_mapObj.currentItemMap['a']"></td>
    	<td>
    		8316M0680</td>
    </tr>
    <tr>
    	<td>
    		<input type="checkbox" checked="checked" value="1" title="aa" name="mapObj.currentItemMap['aa']" id="mapObj.currentItemMap['aa']1">
    		<input type="hidden" value="on" name="_mapObj.currentItemMap['aa']"></td>
    	<td>
    		8317M0770</td>
    </tr>
    the bug is, checkbox elements must be checked.
    Last edited by eros; Apr 1st, 2011 at 02:50 AM.
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

  3. #3
    Join Date
    Oct 2008
    Posts
    286

    Default

    I am using 2.5.6SEC01 version, this bug was already resolved in 3.x?
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

  4. #4
    Join Date
    Oct 2008
    Posts
    286

    Default

    I accidentally discovered the problem.

    During the data binding to Map<String, String> type, single character String type was converted to Character type.

    Anyone here encountered the same phenomenon?
    Last edited by eros; Apr 6th, 2011 at 01:12 AM.
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

  5. #5
    Join Date
    Oct 2008
    Posts
    286

    Default

    Overriding the data binding class or some similar approach may solve my problem.

    Anyone here, knows what class do I need to override? and functionality to override?
    Eros

    Environment:
    JSP 2.0
    Dojo 1.4.1
    Ext JS 3.1 (testing)
    Spring MVC 2.5.6.SEC01 (planning to Spring 3 using STS)
    STS
    SWF 2.0.9.RELEASE
    Tiles 2.0.5
    iBatis: ibatis-sqlmap-2.3.4.726

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •