You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Olivier Corbun <ol...@corbun.com> on 2004/04/27 10:38:31 UTC

java.util.Map in an ActionForm to get String, FormFile and String[]

Hi!
I need to generate a dynamic html form, the entries and their type
coming from a database. The tricky part is that inputs might be
String, String[] or FormFile. To solve that I am using a Map in my
ActionForm. And it works fine for text and FormFile entries. But when
I want to get a multiple choice input I only see the first String and
not an array.
It actually looks like a bug to me.

MyForm.java:

Map answers = new HashMap();
public Map getAnswers() {return answers;}
public void setAnswers(Map x) {answers=x;}

Example of generated html code:

<input type="text" name="answers(screenwidth)" value="0">
<input type="file" name="answers(Xfile)">
<select name="answers(code)" multiple>
  <option value="US-ASCII">US-ASCII</option>
  <option value="ISO-8859-1">ISO-8859-1</option>
  <option value="UTF-8">UTF-8</option>
</select>

Out of that I am getting three things in my Map, a "screenwidth" with
a value as a String (correct), a "Xfile" with a FormFile object as
value (correct) and a "code" with only one String as value not a
String[] (incorrect).
BUG or not BUG?
thanks
-olivier


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org