Re: Dynamically generating multiple sets of radio buttons

2018-03-03 Thread Dave Weis
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 
wrote:

>
>
> On 2/27/2018 4:37 PM, Dave Weis wrote:
> >  > value="1500"/>HOTTER
> >  public void setVariation(HashMap variationItem){
> >
> > logger.error("setVariation was called with variations");
> >
> > for (Map.Entry 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 for defining variation instead with java
> simple getter and setter.
>
> Regards.
>
>


Re: Dynamically generating multiple sets of radio buttons

2018-03-02 Thread Yasser Zamani


On 2/27/2018 4:37 PM, Dave Weis wrote:
>  value="1500"/>HOTTER
>  public void setVariation(HashMap variationItem){
> 
> logger.error("setVariation was called with variations");
> 
> for (Map.Entry 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 for defining variation instead with java
simple getter and setter.

Regards.



Re: Dynamically generating multiple sets of radio buttons

2018-02-27 Thread Dave Weis
I've distilled my issue down a bit. Now I can't get my indexed setters to
be called with the values from the page.

This is in my HTML created with the radio tag:


HOT
HOTTER








Small
Medium
Large




My setter in the destination action is:

 public void setVariation(HashMap variationItem){

logger.error("setVariation was called with variations");

for (Map.Entry entry : variationItem.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();

logger.error(key + "=" + value);
}


 }

It gets called but there is no data in the hashmap.

I also turned up the debugging in log4j and see the following:

07:05:39.556 DEBUG com.opensymphony.xwork2.ognl.SecurityMemberAccess -
Checking access for [target:
com.subecon.actions.commerce.CartAction@56dda392, member: public void
com.subecon.actions.commerce.CartAction.setVariation(java.util.HashMap),
property: variation]
07:05:39.556 DEBUG com.opensymphony.xwork2.ognl.SecurityMemberAccess -
Checking access for [target:
com.subecon.actions.commerce.CartAction@56dda392, member: public void
com.subecon.actions.commerce.CartAction.setVariation(java.util.HashMap),
property: variation]
07:05:39.557 DEBUG com.opensymphony.xwork2.ognl.SecurityMemberAccess -
Checking access for [target:
com.subecon.actions.commerce.CartAction@56dda392, member: public void
com.subecon.actions.commerce.CartAction.setVariation(java.util.HashMap),
property: variation]
07:05:39.557 DEBUG com.opensymphony.xwork2.ognl.SecurityMemberAccess -
Checking access for [target:
com.subecon.actions.commerce.CartAction@56dda392, member: public void
com.subecon.actions.commerce.CartAction.setVariation(java.util.HashMap),
property: variation]
07:05:39.557 DEBUG com.opensymphony.xwork2.ognl.SecurityMemberAccess -
Checking access for [target:
com.subecon.actions.commerce.CartAction@56dda392, member: public void
com.subecon.actions.commerce.CartAction.setVariation(java.util.HashMap),
property: variation]
07:05:39.557 DEBUG com.opensymphony.xwork2.ognl.SecurityMemberAccess -
Checking access for [target:
com.subecon.actions.commerce.CartAction@56dda392, member: public void
com.subecon.actions.commerce.CartAction.setVariation(java.util.HashMap),
property: variation]
07:05:39.557 ERROR com.subecon.actions.commerce.CartAction - setVariation
was called with variations
07:05:39.557 DEBUG com.opensymphony.xwork2.conversion.impl.XWorkConverter -
Retrieving convert for class [class
com.subecon.actions.commerce.CartAction] and property [variation.null]
07:05:39.557 DEBUG com.opensymphony.xwork2.conversion.impl.XWorkConverter -
Retrieving convert for class [class
com.subecon.actions.commerce.CartAction] and property [variation.null]

Is my method signature incorrect? Thank you!
dave







On Sun, Feb 25, 2018 at 8:57 AM, Dave Newton  wrote:

> It’s not entirely clear to me what you’re asking.
>
> `getItemList` will return whatever it returns—if the logic for what should
> return lies in the view layer then it’s an architectural problem.
>
> If you need to return two lists then you should have two list getters. If
> the view layer *presentation* of the list varies by list content then the
> list should be presented in a structure that represents that, e.g.,
>
> Class ViewList {
> String representation; // e.g., “radio”, “dropdown”, etc.
> List items; // The things to show
> }
>
> If it depends on actions *taken* in the view layer, e.g., something
> JavaScript-y, then all this is out the window and we’d need more
> information.
>
> Dave
>
> On Sat, Feb 24, 2018 at 5:00 PM Dave Weis  wrote:
>
> > Hello
> >
> > I am trying to make multiple sets of radio buttons with independent lists
> > of valid options. The options are all generated dynamically.
> >
> > I'm having trouble figuring out how to declare the item list provider in
> my
> > java code. I have it working fine for a single item. With the sample
> below
> > I get the same list for both my radio buttons and my dropdown but I need
> to
> > be able to modify the list returned based on which line of input I'm on.
> >
> > Thank you
> > dave
> >
> >
> >
> >
> >
> > 
> >
> > 
> > 
> >
> > 
> > 
> > we have a variation 
> > 
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> >
> >
> > public ArrayList getItemList() {
> >
> > logger.debug("get item list");
> > ArrayList retval = new ArrayList();
> > retval.add("the first option");
> > retval.add("the second option");
> > return retval;
> > }
> >
> --
> e: davelnew...@gmail.com
> m: 908-380-8699
> s: davelnewton_skype
> t: @dave_newton 
> b: Bucky Bits 
> g: davelnewton 
> so: Dave Newton 
>


Re: Dynamically generating multiple sets of radio buttons

2018-02-25 Thread Dave Weis
I'm trying to make a form that can contain an arbitrary number of attribute
choices. Think of a tshirt with color and size.

I have a Product that contains Variations (size, color) that contain
VariationItems (blue, XL).

The variation can be either a dropdown or a radio button set.







we have a variation 






















On Sun, Feb 25, 2018 at 8:57 AM, Dave Newton  wrote:

> It’s not entirely clear to me what you’re asking.
>
> `getItemList` will return whatever it returns—if the logic for what should
> return lies in the view layer then it’s an architectural problem.
>
> If you need to return two lists then you should have two list getters. If
> the view layer *presentation* of the list varies by list content then the
> list should be presented in a structure that represents that, e.g.,
>
> Class ViewList {
> String representation; // e.g., “radio”, “dropdown”, etc.
> List items; // The things to show
> }
>
> If it depends on actions *taken* in the view layer, e.g., something
> JavaScript-y, then all this is out the window and we’d need more
> information.
>
> Dave
>
> On Sat, Feb 24, 2018 at 5:00 PM Dave Weis  wrote:
>
> > Hello
> >
> > I am trying to make multiple sets of radio buttons with independent lists
> > of valid options. The options are all generated dynamically.
> >
> > I'm having trouble figuring out how to declare the item list provider in
> my
> > java code. I have it working fine for a single item. With the sample
> below
> > I get the same list for both my radio buttons and my dropdown but I need
> to
> > be able to modify the list returned based on which line of input I'm on.
> >
> > Thank you
> > dave
> >
> >
> >
> >
> >
> > 
> >
> > 
> > 
> >
> > 
> > 
> > we have a variation 
> > 
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> >
> >
> > public ArrayList getItemList() {
> >
> > logger.debug("get item list");
> > ArrayList retval = new ArrayList();
> > retval.add("the first option");
> > retval.add("the second option");
> > return retval;
> > }
> >
> --
> e: davelnew...@gmail.com
> m: 908-380-8699
> s: davelnewton_skype
> t: @dave_newton 
> b: Bucky Bits 
> g: davelnewton 
> so: Dave Newton 
>


Re: Dynamically generating multiple sets of radio buttons

2018-02-25 Thread Dave Newton
It’s not entirely clear to me what you’re asking.

`getItemList` will return whatever it returns—if the logic for what should
return lies in the view layer then it’s an architectural problem.

If you need to return two lists then you should have two list getters. If
the view layer *presentation* of the list varies by list content then the
list should be presented in a structure that represents that, e.g.,

Class ViewList {
String representation; // e.g., “radio”, “dropdown”, etc.
List items; // The things to show
}

If it depends on actions *taken* in the view layer, e.g., something
JavaScript-y, then all this is out the window and we’d need more
information.

Dave

On Sat, Feb 24, 2018 at 5:00 PM Dave Weis  wrote:

> Hello
>
> I am trying to make multiple sets of radio buttons with independent lists
> of valid options. The options are all generated dynamically.
>
> I'm having trouble figuring out how to declare the item list provider in my
> java code. I have it working fine for a single item. With the sample below
> I get the same list for both my radio buttons and my dropdown but I need to
> be able to modify the list returned based on which line of input I'm on.
>
> Thank you
> dave
>
>
>
>
>
> 
>
> 
> 
>
> 
> 
> we have a variation 
> 
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
>
>
> public ArrayList getItemList() {
>
> logger.debug("get item list");
> ArrayList retval = new ArrayList();
> retval.add("the first option");
> retval.add("the second option");
> return retval;
> }
>
-- 
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton 
b: Bucky Bits 
g: davelnewton 
so: Dave Newton 


Dynamically generating multiple sets of radio buttons

2018-02-24 Thread Dave Weis
Hello

I am trying to make multiple sets of radio buttons with independent lists
of valid options. The options are all generated dynamically.

I'm having trouble figuring out how to declare the item list provider in my
java code. I have it working fine for a single item. With the sample below
I get the same list for both my radio buttons and my dropdown but I need to
be able to modify the list returned based on which line of input I'm on.

Thank you
dave












we have a variation 





















public ArrayList getItemList() {

logger.debug("get item list");
ArrayList retval = new ArrayList();
retval.add("the first option");
retval.add("the second option");
return retval;
}