I am also active at:
Monday, April 27, 2020
Tuesday, April 21, 2020
Monday, April 20, 2020
How to run javascript inside a JSP scriplet
By writing your js code within <script></script> tag inside out.println() has shown below:
<%
if( a > 9)
{
out.println("<script>document.getElementById('rd"+(a+1)+"').disabled=true;</script>");
}
%>
How to comment JSP code
<%-- This is a JSP comment and will be completely ignored by the JSP compiler --%>
How to disable a option in a set of radio buttons
<input type="radio" name="disableme" id="1"> Animal
<input type="radio" name="disableme" id="2"> Mammal <input type="radio" name="disableme" id="3"> Human
document.getElementById("1").disabled = true;
source:
https://www.w3schools.com/jsref/prop_radio_disabled.asp
https://stackoverflow.com/questions/13245672/how-to-disable-the-radio-button-using-javascript-not-using-any-js-framework
<input type="radio" name="disableme" id="2"> Mammal <input type="radio" name="disableme" id="3"> Human
document.getElementById("1").disabled = true;
source:
https://www.w3schools.com/jsref/prop_radio_disabled.asp
https://stackoverflow.com/questions/13245672/how-to-disable-the-radio-button-using-javascript-not-using-any-js-framework
Saturday, April 18, 2020
Thursday, April 16, 2020
JDBC: Check if the record exists in the database
Assuming you are working with a newly returned
ResultSet
whose cursor is pointing before the first row, an easier way to check this is to just call isBeforeFirst()
. This avoids having to back-track if the data is to be read.if (!resultSet.isBeforeFirst() ) {
System.out.println("No data"); } else{ while(resultSet.next()){ resultSet.getString(1); resultSet.getString(1); …. …. resultSet.getString(n); } } source: https://stackoverflow.com/questions/867194/java-resultset-how-to-check-if-there-are-any-results
Wednesday, April 15, 2020
Java enums
Let us see another example of Java enum where we are using value(), valueOf(), and ordinal() methods of Java enum.
- class EnumExample1{
- //defining enum within class
- public enum Season { WINTER, SPRING, SUMMER, FALL }
- //creating the main method
- public static void main(String[] args) {
- //printing all enum
- for (Season s : Season.values()){
- System.out.println(s);
- }
- System.out.println("Value of WINTER is: "+Season.valueOf("WINTER"));
- System.out.println("Index of WINTER is: "+Season.valueOf("WINTER").ordinal());
- System.out.println("Index of SUMMER is: "+Season.valueOf("SUMMER").ordinal());
- }}
Output:
WINTER SPRING SUMMER FALL Value of WINTER is: WINTER Index of WINTER is: 0 Index of SUMMER is: 2
source: https://www.javatpoint.com/enum-in-java
Subscribe to:
Posts (Atom)
How can I run a C++ program directly from Windows?
How-can-I-run-a-C-program-directly-from-Windows
-
Acronym Full Form AJAX Asynchronous JavaScript and XML API Application Programming Interface APK Android Application Package ASP Activ...
-
#include<stdio.h> int main() { int M,N,q; scanf("%i %i",&M, &N); if((M%N)!=0) {printf("0&quo...
-
"A good company understands that problem solving ability and the ability to learn new things are far more important than knowledge o...