Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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

Win a copy of The Software Craftsman this week in the Agile forum!
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: 62317

Moved to the Struts forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: struts link onclick question