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:50:56 GMT
HI,
	How r u populating your map for the string values?
R u using request.getParameterValues(paramName) ?

Regards
	marco

-----Original Message-----
From: Olivier Corbun [mailto:olivier@sun.com] 
Sent: 27 April 2004 10:40
To: Struts Users Mailing List
Subject: Re: java.util.Map in an ActionForm to get String, FormFile and
String[]

The list of properties is dynamic, coming from the DB.
It means I do not know their names and types in advance.
I cannot decide that I have one and only one String[] X
property in my Form. DynaActionForm or ActionForm doesn't
really make a difference here right?

A Map looks like a good idea to me, it is just a pitty
it worked "almost" all the way.

thanks


Marco Mistroni wrote:
> 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
> 

---------------------------------------------------------------------
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