You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tamas Szabo <sz...@gmail.com> on 2005/08/25 16:34:27 UTC

SpringBindingActionForm

Hi,

Has anybody used the
org.springframework.web.stuts.SpringBindingActionForm class?

The class extends ActionForm and the typical use, according to the
javadoc is:

public ActionForward execute(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest request, HttpServletResponse response)
throws Exception {
    SpringBindingActionForm form = (SpringBindingActionForm) actionForm;
    MyPojoBean bean = ...;
    ServletRequestDataBinder binder = new ServletRequestDataBinder(bean, "myPojo");
    binder.bind(request);
    form.expose(binder.getErrors(), request);
    return actionMapping.findForward("success");
}

After doing this the properties of the MyPojoBean will be exposed in the JSP so that 
<html:text ... > tags will work as SpringBindingActionForm had these properties declared.

Do you know how this works?
I mean the SpringBindingActionForm doesn't actually have the properties and 
<html:text property="xxx" /> will end up in calling a getXxx() to set the value of the
text field.

I know that I could find it out from the code, I tried, but it's not a simple implementation
and currently I have no time to look at this in more detail.
So I hope that somebody knows the answer. If not I will check the code when I will have some free time.

It's not only curiosity, I would like to know how it works because

<c:out value="{actionForm.xxx}" />

doesn't work. (actionForm is the attribute set in the action mapping in struts-config.xml and xxx is an 
arbitrary property of exposed bean.
It says that the class SpringBindingActionForm doesn't have a property named xxx.
Which is true ... But the <html:text ...> works.

I hope somebody can help me with this one.

Thanks in advance,

Tamas






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org