Mhh... I guess the getter method doesn't help, since I don't want to access
the properties of the action from JSP. I just want to *receive* the
submitted indexed parameters from the HTML-snippet, which means I need some
sort of a setter method. I already tried

public void setAmount(Map amount) {
  /*...*/
}

which worked somehow. The Struts 2 framework will call the setAmount method
2 times (using my example from above). On each call the parameter "amount"
contains a Map which has only one Key/Value pair (first call: "10"=>"33.3",
second call "20"=>"66.6")

Ok, i could add each Map to a collection and than loop through the
collection and each keySet later in the execute method but that's plain
ugly. There must be a pretty and simple solution, right? If Struts 2 really
wants me to write a conversion properties file for that, than life was
really easier with Struts 1.


2008/9/16 Dave Newton <[EMAIL PROTECTED]>

> --- On Tue, 9/16/08, tREXX - <[EMAIL PROTECTED]> wrote:
> > class VerySimpleAction extends ActionSupport {
> >   private Map<Integer, Float> amount;
> >   public String execute() throws Exception {
> >      System.out.println(amount.get(10));
> >      System.out.println(amount.get(20));
> >   }
> >   /* ??? */
> > }
> >
> > What code do i have to write in place of the question
> > marks, so that system.out will write "33.3" and "66.6"?
>
> public Map<Integer, Float> getAmount() { return amount; }
>
> (You might need to create a Map instance; not sure if it'll create it for
> you in this case or not without a conversion properties file.)
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to