You can use javascript for this:
<html:link href="#" onclick="document.forms[0].submit(); return false;">
<img src="images/whatever.gif" border="0">
</html:link>
And as per the suggestion Peter made to me the other day, use the same
sort of call to modify the form action before posting if you're posting
to different locations.
--tom
Justin Kennedy wrote:
>
> Hi all
>
> I've created a form like so:
> <form:form name="users" action="users.do" focus="username"
> type="com.admin.forms.UsersForm">
>
> which contains a select box named 'username'
>
> I want to provide a link which will post the form. I've created
> UsersForm.java to validate, and it returns an error if username isn't
> selected. Everything works fine with:
> <form:submit value="Add User"/>
>
> But I want to accomplish this with:
> <html:link page="/users.do?action=AddUsr">Add User</html:link>
>
> When I click on this link, it comes back to the same page with the error
> message I provided in UsersForm.validate() of "you must select a username",
> even though I've selected a username.
>
> So, by specifying users.do for page in <html:link doesn't the controller
> servlet populate UsersForm with the request params and call validate ? It's
> obviously calling validate, but the bean properties seem like there not
> being set.
>
> The reason I want links instead of submit button is because I'm going to
> have multiple links that specify a different '?action=' so the target page
> can process accordingly
>
> Thanx,
> -Justin