struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Mistroni" <mmistr...@waersystems.com>
Subject RE: java.util.Map in an ActionForm to get String, FormFile and String[]
Date Tue, 27 Apr 2004 09:32:31 GMT
Hi,
	Can't u use a DynaActionForm,where u define one
Of the properties as String[]?

Regards
	marco

-----Original Message-----
From: Olivier Corbun [mailto:olivier@sun.com] 
Sent: 27 April 2004 10:16
To: user@struts.apache.org
Subject: 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


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


Mime
View raw message