• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Re: using javascript in jsp's

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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" %>
<head>
<script type="text/javascript">
function set(target)
{
document.forms.dispatchForm.dispatch.value=target;
<!--document.forms.DispatchForm.submit();-->
}
</script>
</head>

<body>
<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">
<tr>
<td colspan="2"> Are you sure you would like to logout?</td>
</tr>
<tr>
<td>
<html:submit property="action" value="OK" onClickage="set('ok');" />
</td>
<td>
<html:submit property="action" value="Cancel" onClickage="set('cancel');" />
</td>
</tr>
</table>
<br/>

</html:form>
</body>

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