aspose file tools*
The moose likes Struts and the fly likes hashmap problem with special character Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "hashmap problem with special character" Watch "hashmap problem with special character" New topic
Author

hashmap problem with special character

patni pat
Greenhorn

Joined: Nov 28, 2012
Posts: 5
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: 39815
    
  28
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: 5
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: 8206
    
  23

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?
Articles by Winston can be found here
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18887
    
    8

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