Samual Sam has Published 2310 Articles

What is a page directive in JSP?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

241 Views

The page directive is used to provide instructions to the container. These instructions pertain to the current JSP page. You may code page directives anywhere in your JSP page. By convention, page directives are coded at the top of the JSP page.Following is the basic syntax of the page directive ... Read More

How to generate large random numbers in Java?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

681 Views

For large random numbers, use BigInteger type in Java. At first, create a Random object −Random randNum = new Random();Now, declare a byte array and generate random bytes −byte[] b = new byte[max]; randNum.nextBytes(b);Now, generate a large random number with BigInteger type −BigInteger bigInt = new BigInteger(b);Example Live Demoimport java.math.BigInteger; import ... Read More

How to execute SQL update query in a JSP?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

557 Views

The tag executes an SQL statement that does not return data; for example, SQL INSERT, UPDATE, or DELETE statements.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultsqlSQL command to execute (should not return a ResultSet)NoBodydataSourceDatabase connection to use (overrides the default)NoDefault databasevarName of the variable to store the count of ... Read More

Query with values prepended by ampersand works in Oracle but not in MySQL?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

122 Views

Ampersands work in Oracle. To work it in MySQL, use @ as shown in the following syntax −SET @yourVariableName1 = yourValue, @yourVariableName2 = yourValue, @yourVariableName3 =yourValue, .........N; insert into yourTableName values(@yourVariableName1, @yourVariableName2, @yourVariableName3, ........N);To understand the above syntax, let us create a table. The query to create a table is ... Read More

How can I generate random booleans in Java?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

346 Views

To generate random booleans like TRUE or FALSE, at first create a new Random object −Random randNum = new Random();Now, loop through the count of booleans you want and generate random booleans with nextBooleans() method −for (int i = 1; i

ConcurrentSkipListSet in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

275 Views

The ConcurrentSkipListSet has elements that are sorted by default. Also, its implementation is based on the ConcurrentSkipListMap. The ConcurrentSkipListSet class also implements the Collection interface as well as the AbstractSet class. It is a part of the Java Collection Framework.A program that demonstrates this is given as follows −Example Live Demoimport ... Read More

Java Signature getProvider() method

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

193 Views

The provider for the signature object can be obtained using the method getProvider() in the class java.security.Signature. This method requires no parameters and it returns the provider for the signature object.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo {    public ... Read More

What is a buffer attribute in JSP?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

995 Views

The buffer attribute specifies the buffering characteristics for the server output response object.You may code a value of "none" to specify no buffering so that the servlet output is immediately directed to the response object or you may code a maximum buffer size in kilobytes, which directs the servlet to ... Read More

How to execute DELETE SQL in a JSP?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

870 Views

The tag executes an SQL statement that does not return data; for example, SQL INSERT, UPDATE, or DELETE statements.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultsqlSQL command to execute (should not return a ResultSet)NoBodydataSourceDatabase connection to use (overrides the default)NoDefault databasevarName of the variable to store the count of ... Read More

Differences between TreeMap, HashMap and LinkedHashMap in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

455 Views

Details about TreeMap, HashMap and LinkedHashMap that help to differentiate them are given as follows −TreeMap in JavaA TreeMap in Java is implemented using a Red-Black trees. It has key-value pairs i.e. keys that are associated with the values and the keys are ordered. A TreeMap can only have unique ... Read More

Advertisements