Ahh - are you using ww2? I'm not quite sure what the ww2 expression would
be. I think it would be object.string("foo") but you'd have to ask Patrick
:)

As for the ModelDriven interface, I'm not sure I fully understand this at
the moment.

For my mind, the difference between model driven and field driven is this:

Model-driven action:

Action {
  public MyBean getMyBean() { return Registry.retrieveMyBean(); }
  public String execute() {
     doModelUpdate(getMyBean());
  }
}

And your views use myBean/field to get/set fields.

Field-driven action:

Action {
  String field;

  public String getField() { return field; }
  public void setField(String s) { field = s; }
  public String execute() {
     MyBean bean = Registry.retrieveMyBean();
     bean.setField(field);
     doModelUpdate(bean);
  }
}

And your views use 'field' to get/set fields.


The first way needs much less code (and cannot be done in Struts I don't
think!), but the second is 'safer' if your model might change etc.

Cheers,
Mike



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

> Mike,
> 
> thanks for the quick reply.
> 
> On Wednesday 18 June 2003 02:10, Mike Cannon-Brookes wrote:
>> Rene,
>> 
>> You can do this (I think) like any other model driven action.
> 
> Do I have to implement ModelDriven for my ActionClass?
>> 
>> GenericValue getObject() {
>>  // lookup the object and return it
>> }
>> 
> 
> I do have...
> 
>> Then in your JSPs, the fields are just named "object/string("foo")"
>> 
> 
> Hmph - could you explain this expression in few words? I'm just new to it and
> fighting with OGNL ;)
> 
>> Haven't tested this - but I think it should work.
>> 
> 
> Put it into my testform, causing a senseless exception:
> Error executing action: null
> 
> org.apache.jasper.JasperException
> at 
> 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254>
)
> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at 
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.ja
> va:684)
> at 
> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher
> .java:432)
> at 
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.j
> ava:356)
> at 
> com.opensymphony.webwork.dispatcher.ServletDispatcherResult.execute(ServletDis
> patcherResult.java:61)
> at 
> com.opensymphony.xwork.ActionInvocation.executeResult(ActionInvocation.java:22
> 0)
> at com.opensymphony.xwork.ActionInvocation.invoke(ActionInvocation.java:160)
> at 
> com.opensymphony.xwork.interceptor.AbstractInterceptor.intercept(AbstractInter
> ceptor.java:37)
> at com.opensymphony.xwork.ActionInvocation.invoke(ActionInvocation.java:148)
> at 
> com.opensymphony.xwork.interceptor.AbstractInterceptor.intercept(AbstractInter
> ceptor.java:37)
> at com.opensymphony.xwork.ActionInvocation.invoke(ActionInvocation.java:148)
> ...
> 
> The exact code in jsp was
> <ww:textfield label="English" name="currentObject/string('en')" />
> 
> Is there a typo I missed? Sh*t, RTFC for Ognl is tricky... :)
> 
> 
> Regards & Thanks
> Rene
> 
>> 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???
>>> [..]



-------------------------------------------------------
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