I am trying to trigger a method in the action file from a java script and here is the code that I currently have:
<img src="image/travel.jpg" alt="test" onclick="javascript:doABC();"/>
Here is the corresponding javascript part:
<script language="javascript">
function doABC(){
var form = document.forms["Welcome"];
form.action = "Welcome.action";
form.submit();
}
</script>
This allows me to call the execute method. However, I need to be able to call different methods. For instance, instead of execute(), I want to call test(). But I am unsure how to achieve this. One way I can handle calling different methods is by using buttons like this:
<s:submit method="execute" value="Enter The Site" align="center"/>
<s:submit method="test" value="Enter The Site" align="center"/>
How can I call the test() method through the onclick event of the image?