You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Poppe, Troy" <Tr...@eia.doe.gov> on 2004/03/09 20:37:29 UTC
tag and DynaActionForm
I have an <html:image> tag inside a <html:form> tag, which points to one of my
Struts Actions. My Action utilizes a DynaActionForm, in which I have defined
several form-property entries. One of these form-property entries, lets call it
"imageProperty" matches the property attribute of my <html:image> tag, also
"imageProperty".
However, in my Action, when I have clicked on the image generated by the
<html:image> tag, the DynaActionForm object does NOT contain an entry for the
<html:image> property attribute.
I would expect that my call to dynaForm.get("imageProperty") would return
something other than throwing an IllegalArgumentException.
Here's the HTML:
<html:form action="myAction">
<html:image page="/img/myImage.gif" property="imageProperty" />
</html:form>
The struts-config.xml:
<form-bean dynamic="true" name="myActionForm"
type="org.apache.struts.action.DynaActionForm" >
<form-property name="imageProperty" type="java.lang.String" />
</form-bean>
<action attribute="myActionForm" name="myActionForm" path="/myAction"
type="com.foo.bar.MyAction" validate="false">
<forward ... />
</action>
The Action code:
....
DynaActionForm dynaForm = (DynaActionForm) form;
if ( dynaForm != null )
{
Object o = dynaForm.get("imageProperty");
}
....
Any thoughts on what I am doing wrong here?
T
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: tag and DynaActionForm
Posted by Thomas Plümpe <th...@gmx.de>.
> I have an <html:image> tag inside a <html:form> tag, which points to one of my
> Struts Actions. My Action utilizes a DynaActionForm, in which I have defined
> several form-property entries. One of these form-property entries, lets call it
> "imageProperty" matches the property attribute of my <html:image> tag, also
> "imageProperty".
>
> <form-property name="imageProperty" type="java.lang.String" />
You should probably use something like an ImageButtonBean [1] instead of
a String. And make sure you have not set the value property [2].
[1] http://husted.com/struts/tips/001.html
[2] http://www.mail-archive.com/struts-user@jakarta.apache.org/msg47235.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org