I am designing an attendance system. on the attendance page, there is roll no., name and present (which is a checkbox). Now what I want to do is if the checkbox is checked it will update attended and total field in my attendance table. and if it is unchecked then it will only update the total field. I am facing a problem when it is unchecked otherwise it is updating in the table.
For checked checkbox if condition is working but what should be else condition since i am unable to get unchecked checkbox. Suggest me something for attendance system working properly.
First, you're using scriptlets and putting Java code in a JSP. That hasn't been considered good practice for probably 20 years. For one thing, it's an absolute nightmare to debug Java code in a JSP. Use a servlet for the code and let the JSP display the results.
Secondly, the Class.forName() call is also at least 10 years obsolete at a rough guess. You don't need it even in a servlet.
Third, actually using the DriverManager to get a database connection is not the best way for a webapp to get a connection. It's better to use a server-supplied Connection Pool. But that's something you can do later when you get serious.
And finally - the answer you've been waiting for!
And the answer is... You can't do it.
HTML doesn't send back an "unchecked" indicator for unchecked checkboxes. It only sends the checked checkboxes. So the way to tell a box has not been checked it to attempt to obtain its parameter value. If you get back null - meaning that the parameter was not returned from the form - then the box is unchecked.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
posted 2 months ago
So is there any other option for attendance system, so that if student is present two fields of attendance table gets updated(attend and total field) and if not present then only one field(total) gets updated.
And also i can't use radio button because for the list of students displaying and their corresponding radio buttons i have used for loop, so the radio button for "present" will have same name and for only one student present can be marked. Please suggest me any approach to do that.
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
Create Edit Print & Convert PDF Using Free API with Java