Java Articles

Page 48 of 450

Provider getInfo() method in Java

Samual Sam
Samual Sam
Updated on 11-Mar-2026 634 Views

An easily readable description of the provider and its services can be obtained using the method getInfo() in the class java.security.Provider. This method requires no parameters and it returns a provider and services description.A program that demonstrates this is given as follows −Exampleimport java.security.*; import java.util.*; public class Demo {    public static void main(String[] argv) throws Exception {       try {          SecureRandom sRandom = SecureRandom.getInstance("SHA1PRNG");          Provider p = sRandom.getProvider();          System.out.println("The information is as follows:");          System.out.println(p.getInfo());       } catch (NoSuchAlgorithmException ...

Read More

Provider getName() method in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 181 Views

The name of the provider can be obtained using the getName() method in the class java.security.Provider. This method requires no parameter and it returns the name of the provider as required.A program that demonstrates this is given as follows −Exampleimport java.security.*; import java.util.*; public class Demo {    public static void main(String[] argv) {       try {          KeyPairGenerator kpGenerator = KeyPairGenerator.getInstance("DSA");          Provider p = kpGenerator.getProvider();          System.out.println("The Provider is: " + p.getName());       } catch (NoSuchAlgorithmException e) { ...

Read More

Provider getVersion() method in Java

Samual Sam
Samual Sam
Updated on 11-Mar-2026 291 Views

The version number of the provider can be obtained using the method getVersion() in the class java.security.Provider. This method requires no parameter and it returns the version number of the provider as required.A program that demonstrates this is given as follows −Exampleimport java.security.*; import java.util.*; public class Demo {    public static void main(String[] argv) {       try {          KeyPairGenerator kpGenerator = KeyPairGenerator.getInstance("DSA");          Provider p = kpGenerator.getProvider();          System.out.println("The version number is: " + p.getVersion()); } catch (NoSuchAlgorithmException e) { ...

Read More

Provider toString() method in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 253 Views

The name and the version number of the provider in string form can be obtained using the method toString() in the class java.security.Provider. This method requires no parameters and it returns the name as well as the version number of the provider in string form.A program that demonstrates this is given as follows −Exampleimport java.security.*; import java.util.*; public class Demo {    public static void main(String[] argv) {       try {          KeyPairGenerator kpGenerator = KeyPairGenerator.getInstance("DSA");          Provider p = kpGenerator.getProvider();          System.out.println("The name and version number of the ...

Read More

Provider getService() method in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 394 Views

The service that can describe the implementation of a Provider in regards to any algorithm is obtained using the method getService() in the class java.security.Provider. This method requires two parameters i.e. the service type required and the algorithm name of the required service.A program that demonstrates this is given as follows −Exampleimport java.security.*; import java.util.*; public class Demo {    public static void main(String[] argv) throws Exception {       try {          Signature sign = Signature.getInstance("SHA256withDSA");          Provider p = sign.getProvider();          Provider.Service s = p.getService("Signature", sign.getAlgorithm());     ...

Read More

Provider values() method in Java

Samual Sam
Samual Sam
Updated on 11-Mar-2026 194 Views

The property values in the Provider can be viewed with an unmodifiable Collection view that is obtained using the method values() in the class java.security.Provider. This method requires no parameters and it returns an unmodifiable Collection view of the property values.A program that demonstrates this is given as follows −Exampleimport java.security.*; import java.util.*; public class Demo {    public static void main(String[] argv) throws Exception {       try {          Signature sign = Signature.getInstance("DSA");          Provider p = sign.getProvider();          Collection val = p.values();          Iterator ...

Read More

How to write a switch statement in a JSP page?

Samual Sam
Samual Sam
Updated on 11-Mar-2026 2K+ Views

Following is the example of using a switch statement within a JSP page.           SWITCH...CASE Example                   The above code will generate the following result −It's Wednesday.

Read More

How to write an if-else statement in a JSP page?

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 16K+ Views

The if...else block starts out as an ordinary Scriptlet, but the Scriptlet is closed at each line with HTML text included between the Scriptlet tags.Example           IF...ELSE Example                         Today is weekend                 Today is not weekend           The above code will generate the following result −Today is not weekend

Read More

How to delete cookies with JSP?

Samual Sam
Samual Sam
Updated on 11-Mar-2026 2K+ Views

To delete cookies is very simple. If you want to delete a cookie, then you simply need to follow these three steps −Read an already existing cookie and store it in Cookie object.Set cookie age as zero using the setMaxAge() method to delete an existing cookie.Add this cookie back into the response header.Following example will show you how to delete an existing cookie named "first_name" and when you run main.jsp JSP next time, it will return null value for first_name.Example           Reading Cookies                        Reading ...

Read More

Where will be the uploaded files stored in JSP?

Samual Sam
Samual Sam
Updated on 11-Mar-2026 571 Views

A JSP can be used with an HTML form tag to allow users to upload files to the server. An uploaded file can be a text file or a binary or an image file or just any document.Creating a File Upload FormLet us now understand how to create a file upload form. The following HTML code creates an uploader form. Following are the important points to be noted down −The form method attribute should be set to POST method and the GET method cannot be used.The form enctype attribute should be set to multipart/form-data.The form action attribute should be set ...

Read More
Showing 471–480 of 4,498 articles
« Prev 1 46 47 48 49 50 450 Next »
Advertisements