You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by fea jabi <zy...@hotmail.com> on 2006/06/21 15:58:06 UTC

javascript and html:image of struts

in my form have

<form-bean name="Form" type="org.apache.struts.action.DynaActionForm">
           .........
            .............
           <form-property name="method" type="java.lang.String"/>
</form-bean>

in jsp
<html:hidden name="Form" property="method"/>
...............................
...........................
<fmt:message var="copyVar" key="lbl.copy" bundle="${appbundle}"/>
<html:image property="method" src="images/arrow.png" value="${copyVar}" 
styleId="copyImgID" onclick="setMethodName();"/>

JS is
<script>
           function setMethodName() {
                 document.forms[0].method.value="Copy";
           }
       </script>

struts-config
<action
           path="/DispatchAction"
           type="com.DispatchAction"
           name="Form"
           scope="session"
           parameter="method">
...................
           <forward name="successCopy" path="/PrepareAction.do" 
redirect="false"/>
.................................
       </action>

Apart from this <html:image> have other submit buttons in the JSP.

<fmt:message var="findLink" key="lbl.find" bundle="${appbundle}"/>
<html:submit onclick="" property="method" value="${findLink}" 
styleClass="submitLink"/>

Using LookupDispatchAction to know which button is pressed. Everything works 
great but the html:image is not working.

I am using javascript to set the method value. Being a hidden value I 
thought it'll submit the method value to the action.


But getting
javax.servlet.ServletException: Request[/DispatchAction] does not contain 
handler parameter named 'method'.  This may be caused by whitespace in the 
label text.

What am I missing?

Thanks.

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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