Rene,

You can do this (I think) like any other model driven action.

GenericValue getObject() {
 // lookup the object and return it
}

Then in your JSPs, the fields are just named "object/string("foo")"

Haven't tested this - but I think it should work.

Cheers,
Mike

On 18/6/03 9:37 AM, "Rene Gielen" ([EMAIL PROTECTED]) penned the words:

> Hi,
> 
> Kinda new to WW2/XWork, maybe I'm blind, so tell me if I am ;-)
> 
> Here is my problem:
> We work in our database driven application with a persistence Manager that
> abstracts records as objects implementing Map interface - manager is OFBiz
> entity engine, for those who might know it...
> 
> So, if I want to edit a record and store the result back to db, I have to do
> always the same (web environment):
> 1. Prepend the edit view with an initialized currentObject (a Map) in context
> 2. Have a jsp with a form in which inputs are presented for the entries in the
> currentObject the user might change
> 3. Have a store action to which the form in 2. submits. Store the values
> changed in db again.
> 
> The form should read values out of a Map and present them in inputs, ready to
> be changed. But how do I manage to have them dispatched back to the / a Map
> for the store action, including type conversion???
> 
> What I tried till now
> 
> EntityAction.java:
> 
> public abstract class EntityActions extends ActionSupport {
> 
>   protected GenericValue currentObject = null; //GenericValue implements Map
> 
>   public void setCurrentObject(GenericValue object) {..}
> 
>   public GenericValue getCurrentObject() {..}
> 
>   ...
> 
>   public String edit () {
>       // load some GenericValue from db
>       // or create an empty one and set it as currentObject
>       ..
>       return SUCCESS;
>   }
> 
>   public String store () {
>       // store the currentObject, which now should contain the edited
>       // values from our web form
>       ..
>       if (noError) {
>           return SUCCESS;
>       } else {
>           // Do input again to correct values
>           return INPUT;
>       }
>   }
> }
> 
> 
> xwork.xml:
> ...
> <action name="edit" class="de.aixcept.tse.action.EntityActions" method="edit"
>> 
>   <param name="entity">translations</param>
>   <result name="success" type="dispatcher">
>       <param name="location">/WEB-INF/jsp/admin/translation/edit.jsp</param>
>   </result>
>   <interceptor-ref name="defaultStack"/>
> </action>
> 
> <action name="store" class="de.aixcept.tse.action.EntityActions"
> method="store" >
>   <param name="entity">translations</param>
>   <result name="input" type="dispatcher">
>       <param name="location">/WEB-INF/jsp/admin/translation/edit.jsp</param>
>   </result>
>   <result name="success" type="chain">
>       <param name="actionName">edit</param>
>   </result>
>   <interceptor-ref name="defaultStack"/>
> </action>
> ...
> 
> 
> edit.jsp:
> ..
>   <ww:form action="store.action" method="POST" >
>       <ww:textfield label="English :" name="???"
>                     value="#currentObject.get('en')" />
>       <ww:textfield label="German :" name="???"
>                     value="#currentObject.get('de')" />
>       <ww:submit name="storeTrans" />
>   </ww:form>
> ..
> 
> 
> I hope I could explain what I mean...
> 
> Is it possible to dispatch the form parameters back again to currentObject for
> store action, including type conversion? Such as
> 
> 
> Action:
> 
> private Long myNumber = null;
> 
> public Long getMyNumber()
> 
> public void setMyNumber(Long aNumber)
> 
> ...
> 
> form:
> <ww:textfield label="My Number :" name="myNumber" />
> 
> ...
> 
> 
> which will do everything automagically when parameters interceptor is in
> place?
> 
> Can someone help (if anyone understood what I try to do :-) ??
> 
> 
> Regards,
> Rene
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to