The moose likes JSP and the fly likes struts link onclick question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "struts link onclick question" Watch "struts link onclick question" New topic

struts link onclick question

Gregg Kelly

Joined: Feb 10, 2006
Posts: 6
For starters I'm using:
tomcat 5.5.12
struts 1.2.8
os - solaris 10

I have a pretty simply web page/form that have several images (GO ->) that sets a formbean field to the appropiate number of the image clicked. This all works just fine and the code follows:

xx.jsp ---

function setact(action){


<html:form action="/myAction">
<html:hidden name="myForm" property="action"/>
<html:image src="/images/go.gif" on*lick="setact('2')"/>

Now, I wanted to do to same thing with a link --
<html:link action="/myAction" on*lick="setact('6')">Link</html:link>

Unfortunately, this does absolutely nothing. No errors anywhere but does not set the "action" field like the image tag does. Any thoughts why?? I'm sure I'm missing something simple but just don't see it.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63839

Moved to the Struts forum.

[Asking smart questions] [About Bear] [Books by Bear]
subject: struts link onclick question
jQuery in Action, 3rd edition