3 Replies - 1007 Views - Last Post: 19 July 2011 - 08:28 PM

#1 lunixer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 120
  • Joined: 29-January 10

[[JSP]] Why doesn't this button work?

Posted 30 June 2011 - 11:09 AM

I have a button in my JSP that is programmed like this. When I compile and run the web application, the button appears, but nothing happens on click.
 <table>
	            <tr>
	                <td>
		                <button id="showAddLicense" 
		                        class="ur_button" 
		                        onclick="/ir_plus/admin/addRepositoryLicense.action"
 		                        onmouseover="this.className='ur_buttonover';"
 		                        onmouseout="this.className='ur_button';">Add License</button> 
	                </td>
	            </tr>
	        </table>



previously, the button had been a link, like this, and it worked perfectly:

 	        <!-- <c:url var="addLicenseUrl" value="/admin/addRepositoryLicense.action">
 	        </c:url>
 	        <a href="${addLicenseUrl}">Add License</a>
 	        <br/>
 	        <br/>



Any idea what the problem might be? Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: [[JSP]] Why doesn't this button work?

#2 japanir  Icon User is offline

  • jaVanir
  • member icon

Reputation: 1011
  • View blog
  • Posts: 3,025
  • Joined: 20-August 09

Re: [[JSP]] Why doesn't this button work?

Posted 01 July 2011 - 04:19 PM

The onclick is handled on the client, so you'll have to use javascript, like:
<button id='showAddLicense' onclick="javascript:window.location='your_link';">

Was This Post Helpful? 1
  • +
  • -

#3 lunixer  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 120
  • Joined: 29-January 10

Re: [[JSP]] Why doesn't this button work?

Posted 05 July 2011 - 06:10 AM

EDIT: Never mind, I got it. Thanks for the help!!!

View Postjapanir, on 01 July 2011 - 07:19 PM, said:

The onclick is handled on the client, so you'll have to use javascript, like:
<button id='showAddLicense' onclick="javascript:window.location='your_link';">


It still doesn't seem to e working. Any idea what might be wrong? The button still appears and animates when I click it, but no action is forthcoming. Thanks for the help. I'm sorry if it's obvious. This is the first time I've used javascript or JSP and I haven't been able to find a working answer online anywhere.

<!-- below is removed by ross -->
 	        <!-- <c:url var="addLicenseUrl" value="/admin/addRepositoryLicense.action">
 	        </c:url>
 	        <a href="${addLicenseUrl}">Add License</a>
 	        <br/>
 	        <br/> -->
 	        <!-- Below is added by Ross -->
 	         <table>
	            <tr>
	                <td>
		                <button id="showAddLicense" 
		                        class="ur_button" 
		                        onclick="javascript:window.location=/admin/addRepositoryLicense.action;"
 		                        onmouseover="this.className='ur_buttonover';"
 		                        onmouseout="this.className='ur_button';">Add License</button> 
	                </td>
	            </tr>
	        </table>
 	        <!-- End added by Ross -->


This post has been edited by lunixer: 05 July 2011 - 08:19 AM

Was This Post Helpful? 0
  • +
  • -

#4 shadowBean  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 46
  • Joined: 14-June 08

Re: [[JSP]] Why doesn't this button work?

Posted 19 July 2011 - 08:28 PM

Your button code is javascript not java.
Do you have a javascript method that correspond to this command?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1