This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hashmap problem with special character

 
patni pat
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48404
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10109
56
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Clapham
Sheriff
Pie
Posts: 20758
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic