Laurie Harper wrote:
Tom Holmes Jr. wrote:
based on my previous message I want to have multiple-selects named
off of a hashmap.
I have found and read all the documentation of "Mapped Properties" I
could find under Google.
I know my form bean is 100% correct based on the documentation, so
that is a not a worry there.
I have a: HashMap mapValues = null; setMapValues(HashMap
mapValues); returns HashMap with getMapValues()
setMapValue(String key, Object value) and finally
getMapValue(String key)
I created the HashMap in my preActionClass:
HashMap testMap = new HashMap();
testMap.put("a","value of a");
testMap.put("b","value of b");
testMap.put("c","value of c");
I tested this out in the jsp by using: <bean:write name="myFormBean"
property="getMapValue(b)" />
This does return "value of b" correctly.
I can even use a logic:iterate to loop through these three items and
get their key and values correctly!!!
Ultimately, I want three selects:
<select name="mapValues(a)"></select>
<select name="mapValues(b)"></select>
<select name="mapValues(b)"></select>
So ... now I created manually three selects on my jsp page.
<html:select name="myFormBean" property="mapValue(a)" value="not sure
yet"></html:select>
<html:select name="myFormBean" property="mapValue(b)" value="not sure
yet"></html:select>
<html:select name="myFormBean" property="mapValue(c)" value="not sure
yet"></html:select>
I just wanted to see if I could get my HashMap back to the post
Action and it constantly comes back null.
Can anyone help me deal with mapped properties, I am just not having
any luck and I've spent way too much time on this already.
I don't think Struts 1 will create the HashMap for you; you need to
instantiate it yourself (in your form bean's constructor or reset
method, for example). Assuming the map has already been instantiated,
Struts should be able to store form inputs into it OK.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
What I was doing was instantiating the HashMap in the preAction class so
the logic:iterate worked on the JSP page.
But the information wasn't passing to the post Action class.
Thanks for the information again. That kind of information I couldn't
find anywhere. I will try it out ....
BTW ... I'm still trying to create:
<html:select name="myFormBean" property="mapValue(a)" value="not sure
yet"></html:select>
<html:select name="myFormBean" property="mapValue(b)" value="not sure
yet"></html:select>
<html:select name="myFormBean" property="mapValue(c)" value="not sure
yet"></html:select>
When I loop through the HashMap ... for some reason anything in the
property quotes is taken for a literal.
I can't seem to make it work with some form of variable.
Thanks again.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]