permaculture playing cards
The moose likes JSP and the fly likes JSP and Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP and Javascript" Watch "JSP and Javascript" New topic

JSP and Javascript

K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
I have several fields: checkbox, label, and a submit button. The scenario is as follows:

if checkbox = true
enable label/submit


disable label/submit

Now, the checkbox is persistant so I need a way to enable/disable the label and submit when returning to the page based on the value of the checkbox. This is a jsp page that uses a value object to maintain the variable. How can I do this?

Thanks in advance!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63838

Sounds like a simple matter of conditionals on the page. Use <c:if> is using the JSTL (you should be, imo) or if statements in scriptlets otherwise.

Nothing to do with Javascript for when the page is refreshing.

[Asking smart questions] [About Bear] [Books by Bear]
K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
Well, my problem is this... I have a value-object that maintains the value of the checkbox. When the page loads, if the the value is true, I enable the label/submit combo. However, if after the page loads, I decide to uncheck the box, it disables the label/submit combo.

So, I have no problem checking the value-object for true/false and I have no problem creating the javascript to enable/disable the button when the user takes action. I just can't seem to combine the two.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385

I agree. Here's the link:
subject: JSP and Javascript
It's not a secret anymore!