[Opensource] Problem understanding usage for <bean:define> extended tag
Dcomeau at xenos.com
Dcomeau at xenos.com
Thu Feb 13 08:40:40 PST 2003
Ok, this has had me scratching my head and not making very much progress for
the last day and a half :(
I'm trying to use the extended Struts tags, and I'm doing this in my State:
// ...
Transition createGroupTrans = new Transition();
createGroupTrans.setName("createNewGroup");
createGroupTrans.setControllerObject(com.xxx.custom.CreateGroupController.cl
ass);
createGroupTrans.enableReturnToSender(response);
createGroupTrans.addParam("parm1", "parm1value");
response.add(createGroupTrans);
// ...
So I'm adding this transition to the response. It's not in a Block.
In my Jsp view, I'm trying to define a bean to match the Transition object.
I was initially trying to do something along these lines:
<!-- Define a bean for the transition -->
<bean:define id="createGroupTrans" property="/createNewGroup"/>
<!-- Now write out some of the properties of that bean -->
<bean:write name="createGroupTrans" property="url"/>
<p>
<bean:write name="createGroupTrans" property="params"/>
...but that <bean:define> won't work. I traced the code in the
ControllerUtils, and it seems it will only return attributes (as Strings) of
ControllerElement's, and not the ControllerElements themselves. So
therefore the above tags won't work.
Instead, I have to do this:
<bean:write property="/createNewGroup.url"/>
<bean:write property="/createNewGroup.params"/>
It took me a while to figure out how to access the properties like this, but
I still don't understand why I can't use <bean:define> to define a
ControllerElement. It looks like I can if I use the extended
<logic:iterate> tags in this manner:
<logic:iterate id="trans" property="transitions">
<bean:write name="trans" property="params"/>
<p>
<bean:write name="trans" property="url"/>
<p>
</logic:iterate>
...but that's not always useful. Am I missing something or is there some
lack of flexibility here?
Any response would be greatly appreciated!
Dave
More information about the Opensource
mailing list