Rick Salsa wrote:

> Does anyone have any ideas on how to use Value Objects with WebWork? 
> Should I copy the values from the Value Object into the Action object, 
> or is there a way to extend WebWork so that it uses Value objects 
> instead? I'm new to WebWork, so still trying to learn the API.


You can access it by delegation, like this:

public class MyAction
   extends ActionSupport
{
   MyData data = new MyData();

   public MyData getData() { return data; }
   ...
}

in your HTML form you should then use the "data/" prefix:
<input type="text" name="data/foo">
..
which will cause getData().setFoo(<value>) to be invoked when the action 
is executed. Very handy. I do this all the time. My actions pretty much 
always delegates to the business objects (although in my case they're 
commands too) instead of duplicating the get/set's in the action.

> Just trying to find sugggestions on how to best design our app. We're 
> calling the Business Layer through a Session Facade, which returns us 
> Value Objects.

Well, the above should work just fine. I'm using it with great success, 
although (as noted) I use the command pattern instead of session 
facade/value objects. Much more efficient.

/Rickard

-- 
Rickard �berg
Author of "Mastering RMI"
Chief Architect, TheServerSide.com
   The Middleware Company - We Build Experts!



_______________________________________________
Webwork-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webwork-user

Reply via email to