wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "struts link onclick question" Watch "struts link onclick question" New topic
Author

struts link onclick question

Gregg Kelly
Greenhorn

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 ---

<script>
function setact(action){
document.forms[0].action.value=action;
}
</script>

...

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

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.

Thanks!
>>>G
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Moved to the Struts forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts link onclick question
 
Similar Threads
to .do or not to .do?
Setting hidden elements using struts htmlhidden
struts link onclick question
regarding the attribute values in struts-config.xml file
can we replace submit button with link in order to submit form ?