Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String[] is null upon reaching Action

 
Theo van Loon
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all, in my form i have a String[] which i fill using html:text tags. However when i reach the action in which i need the String[] it is null. What can i do to resolve this?
 
Kenneth Brooks
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not exactly following what you mean that you have a String[] in your form?

Are you saying that you have multiple textfields that all have the same name?

-k
 
Ricardo Estafan
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i have a String[] that compares to multiple text fields in the jsp. When i go into the action i guess the form resets and the String[] is null.
 
Rohan Kayan
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Name of the String [] and name of that HTML element should be same or getting the value in the action . Are you using the same name ???
 
Theo van Loon
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok situation now is as follows :

I have two action : one that initializes a shoppingcart and one dispatchaction that updates, deletes etc. In my form i have a map which contains key : product id and value is a String object containing the amount.

my form contains the following methods :




In my JSP i have the following code :


This works for displaying purposes. So it shows the correct amount. Question is though what can i do to update the amounts. When it reaches the action the map is null. Perhaps place the map in the request, but is it then possible to write to the given object using html:text tag.

Does anyone know how to deal with this issue???
[ February 28, 2005: Message edited by: Theo van Loon ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic