Dick Zetterberg wrote:
This touches upon an interesting issue. The above exposes a little too much about the implementation of the action, really.Hi Andre, Putting the properties in its own bean would work fine. However when you write that you would do this "via BeanUtils", I suspect that you mean you would write your own code for this using "BeanUtil.setProperties"? (I know there is one example doing that). Just so you know, you do not have to do that manually. You can let WW do it for you. Just set the names to something like "myBean/oneProperty", for example: <input type="hidden" name="myBean/oneProperty" value="abc"/> That would be similar to: myAction.getMyBean().setOneProperty("abc");
I have an idea: how about adding an interface "Model" that has one method "Object getModel()". It would be implemented in ActionSupport as:
public Object getModel() { return this; }
However, for those cases where a separate bean is used (e.g. a value object from EJB) it would be overriden by the action as:
public Object getModel() { return someModelBean; }
When the dispatcher has executed an action and needs to decide what to put on the ValueStack it simply checks for the Model interface and uses it if available. If not available, then the action itself is used.
This would be largely transparent, but would allow for easy use of the "form bean" concept in Struts. If you need it it's there, but the default is that action=model.
By using this one could avoid doing form names such as "myBean/oneProperty" and simply use "oneProperty" instead, if the getModel() method returns the model to be used both as "input" and as "result".
What say ye?
/Rickard
--
Rickard Öberg
[EMAIL PROTECTED]
Senselogic
Got blog? I do. http://dreambean.com
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork