> -----Original Message-----
> From: Mehran Zonouzi [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 09, 2003 8:24 AM
> To: Struts Users Mailing List
> Subject: How do you mimic the 'a href' functionality in Struts?
> 
> <td width="130"><a 
> href="/servlets/blotter/Contact?page=viewcontactlist" 
> target="rightframe" class="linkbold">Contact List</a></td>
> 
> I want to mimic the above using Struts JSP tags(I don't want 
> to use a SUBMIT button). However, I want to call my 
> ActionForm class instead of the servlet and I would like to 
> set the value of the param 'page' to 'viewcontactlist' for my 
> ActionForm class so that my Action class can use it.
> 
> Is it possible to do this?

Yes.

Your href attribute can point to a JavaScript function that sets some hidden form 
variables then submits the form. It would look something like this:

<script type="text/javascript">
function submitFunctionForYou(lType) {
        document.yerForm.elements["page"].value = lType;
}
</script>

<td>
        <html:form action="/yerAction">
                <html:hidden property="page" />
        </html:form>
        <a href="submitFunctionForYou('viewcontactlist'); return true;">Contact 
List</a>
</td>

-= J

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to