Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Re: using javascript in jsp's

Ruii Costa
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how's things,

I'm having trouble with a jsp where I want to determine which button was selected on a logout confirmation form I have, at the moment I'm trying to do this by using a javascript function to determine a string value " onClick ", and the pass this value to the corresponding actionform(i'm using jsp's with struts,tomcat,java) as a hidden field, but the value been passed is null, I've tried to get this working for a couple of days now, I�m sure its something small, I just can't see it so any help would be appreciated, nice one, here's the jsp:

<title>Logout Confirmation</title>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<script type="text/javascript">
function set(target)

<html:form styleId="dispatchForm" action="/confirmLogout">
<input name="dispatch" type="hidden" property="dispatch" value="ok"/>
<!--<html:hidden name="dispatch" property="dispatch" value="target"/>-->
<!--<input type="hidden" name="dispatch" value="target">-->
<table class="tborder" width="50%" cellspacing="1" cellpadding="3" align="center">
<td colspan="2"> Are you sure you would like to logout?</td>
<html:submit property="action" value="OK" onClickage="set('ok');" />
<html:submit property="action" value="Cancel" onClickage="set('cancel');" />


wasn't allowed to post topic without changing to onClickage,
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic