| Author |
hashmap problem with special character
|
patni pat
Greenhorn
Joined: Nov 28, 2012
Posts: 4
|
|
i am using hashmap under starus tag <s:textfield> passing map key as <s:textfield name="quantityMap['%{#productData.code}']" />.. this should store the quantity(passed in textfield) against productcode. in model its working fine for a normal scenario, but when map key contains "#" like if my productcode is"ADC#3" then its not working at all.
please help
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32675
|
|
Welcome to the Ranch
You would have to provide more details; we cannot tell what is not working.
I cannot see why a Map should have difficulty taking a String with the hash sign # in. I suggest you precede each put(...) call by a line which prints out the key and value. See whether the key is reaching the Map in the same form that it left your HTML file. Are you sure it is the # character rather than quotes which is causing the trouble?
|
 |
patni pat
Greenhorn
Joined: Nov 28, 2012
Posts: 4
|
|
thanks for reply,
there is not any problem of quote because its working fine with other data in same iterator,
i am getting error
WARN [OgnlValueStack] Error setting value
INFO ognl.OgnlException: target is null for setProperty(null, "addtobasket", [Ljava.lang.String;@7d1fae)
INFO | jvm 1 | main | 2012/11/29 14:24:59.190 |
is it the problem of struts textfield or ognl which may not accept "#" in name or id
|
 |
Winston Gutkowski
Bartender
Joined: Mar 17, 2011
Posts: 4749
|
|
patni pat wrote:is it the problem of struts textfield or ognl which may not accept "#" in name or id
Again, without a proper SSCCE, we really have no idea, but what I can tell you is that those are NOT Java error messages.
Like Campbell said: TellTheDetails (←click).
Winston
|
Isn't it funny how there's always time and money enough to do it WRONG?
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Since this seems to be particularly about Struts (does the # character mean something special in Struts? I don't know) then let's put it in the Struts forum where it might get looked at by people who know that.
|
 |
 |
|
|
subject: hashmap problem with special character
|
|
|