Reputation: 1209
I want to have something like this:
public void setButton(){
document.getElementById('scan').disabled=false;
}
scan is the ID of the button in the JSP.
Upvotes: 0
Views: 16450
Reputation: 17923
What you are dealing here is html and javascript and not java. Java based systems at the server will generate the html/css/js based code (after executing the JSP) and send it to browser. For enable/disabling and disabling the buttons, use javascript.
Not sure what you use case is, but you can use following javascript code code to enable/disable the buttons
document.getElementById("scan").disabled = true;
This can be called on any event (like page load etc)..
EDIT: In light of new requirement (Capture USB events), this may not be as straightforward as it seemed. I would suggest following approach.
So it works as follows
Upvotes: 1
Reputation: 406
maybe you can use this
document.getElementById("scan").disabled = true;
or jquery
$("#scan").disable = true;
Upvotes: 0
Reputation: 122008
All the HTML in JSP compiles on server side and comes to Client
.
If you want to do something you need to make a request.
You can do it directly with html in your jsp
<input type="button" name=myButton id="scan" value="disable" disabled>
If javascript
document.getElementById("scan").disabled=true; //not false
Upvotes: 0