struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Reumann" <rick.reum...@gmail.com>
Subject zoning out on some basic LazyDynaMap usage for a text field property?
Date Sat, 01 Dec 2007 00:17:54 GMT
I swore I used to be able to do this stuff... maybe it's Friday thing, but
regardless I'm blanking on out on what I'm doing wrong with this...

I have an ActionForm that has one property right now:
   private LazyDynaBean dynaBean = new LazyDynaMap();

My goal is to be able to populate this DynaBean with any level of nested
DynaMaps and have everything populate correctly using Request scope on my
form. (Not shown here but an 'answer' as a map value can end up being
another Map and so on - nested to any level.)

I'm currently having trouble defining the property name correctly. Here is a
summary

Not working:
<html:text name="myForm" property="dynaBean.map
(question_1).map(answerString)"/>

Error:
Invalid argument looking up property:
"dynaBean.map(question_1).map(answerString)"
of bean: "myForm"

Working fine:
<c:out value="${myForm.dynaBean.map['question_1'].map['answerString']}/>


I'm populating in my Action before the form as:

//create some questions
MyForm mForm = (MyForm)form;
LazyDynaBean dynaBean1 = mForm.getDynaBean();
Map map1 = dynaBean1.getMap();

LazyDynaMap questionAnswer = new LazyDynaMap();
questionAnswer.set("questionText", "Pet's name:");
questionAnswer.set("answerString", "Fido");
map1.put("question_1", questionAnswer);


I've tried a few different ways defining the text field property all with no
luck at the moment. What am I doing wrong? (I know I could also use a
DynaActionForm defined in my struts-config, but this should work as well
with a DynaBean in a standard ActionForm. I typically don't like using
DynaActionForm because I end up usually having to create a reset method
anyway so once I do that I might as well code the properties in that
concrete class.)

-- 
Rick

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