struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Weis <djw...@sjdjweis.com>
Subject Re: Dynamically generating multiple sets of radio buttons
Date Sat, 03 Mar 2018 14:24:58 GMT
That was it! It's now putting key-value pairs in the map obtained by
getVariation and they appear when I get to the execute method.

08:19:35.682 ERROR CartAction - getVariation was called
08:19:35.698 ERROR CartAction - getVariation was called
08:19:36.086 DEBUG CartAction - cart action execute
08:19:36.086 ERROR CartAction - 13000=5600
08:19:36.086 ERROR CartAction - 2000=500

Thank you!

dave





On Sat, Mar 3, 2018 at 1:17 AM, Yasser Zamani <yasserzamani@apache.org>
wrote:

>
>
> On 2/27/2018 4:37 PM, Dave Weis wrote:
> > <input type="radio" name="variation[2000]" id="cart_variation_2000_1500"
> > value="1500"/><label for="cart_variation_2000_1500">HOTTER</label>
> >      public void setVariation(HashMap<String, String> variationItem){
> >
> >     logger.error("setVariation was called with variations");
> >
> >     for (Map.Entry<String, String> entry : variationItem.entrySet()) {
> >         String key = entry.getKey();
> >         String value = entry.getValue();
> >
> >         logger.error(key + "=" + value);
> >     }
> >
> >
> >      }
> > Is my method signature incorrect? Thank you!
>
> I guess Struts wont call setVariation for e.g. variation[2000]=HOTTER.
> Instead I guess it calls getVariation().put(2000, "HOTTER"); maybe you
> should use Map<Integer, String> for defining variation instead with java
> simple getter and setter.
>
> Regards.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message