Karthikeya Boyini has Published 2383 Articles

How to track access time of a webpage using session in a JSP page?

karthikeya Boyini

karthikeya Boyini

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

439 Views

This example describes how to use the HttpSession object to find out the creation time and the last-accessed time for a session. We would associate a new session with the request if one does not already exist.Example Live Demo           Session Tracking       ... Read More

How to disable “Establishing SSL connection without server's identity verification is not recommended” warning when connecting to MySQL database in Java?

karthikeya Boyini

karthikeya Boyini

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

12K+ Views

To disable the warning while connecting to a database in Java, use the below concept −autoReconnect=true&useSSL=falseThe complete syntax is as follows −yourJdbcURL="jdbc:mysql://localhost:yourPortNumber/yourDatabaseName?autoReconnect=true&useSSL=false";Here is the warning message if you do not include “useSSL=false” −Wed Feb 06 18:53:39 IST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According ... Read More

Java 8 Clock hashCode() method

karthikeya Boyini

karthikeya Boyini

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

204 Views

The hash code for a clock object can be obtained using the method hashCode() in the Clock Class in Java. This method requires no parameters and it returns the acceptable hash code for a clock object.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo ... Read More

JavaTuples setAt0() method for Quintet class

karthikeya Boyini

karthikeya Boyini

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

60 Views

The setAt0() method is used to set the Quintet value in JavaTuples and a copy with a new value at the specified index i.e. index 0 here.Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you need to import the following ... Read More

Java Program to convert java.util.Date to Instant

karthikeya Boyini

karthikeya Boyini

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

709 Views

First, set the date −java.util.Date date = new java.util.Date();Now, convert the above date to Instant −Instant instant = date.toInstant();Exampleimport java.time.Instant; public class Demo {    public static void main(String[] args) {       java.util.Date date = new java.util.Date();       System.out.println("Date = "+date);       Instant instant ... Read More

MongoDB query to find property of first element of array?

karthikeya Boyini

karthikeya Boyini

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

956 Views

You can use $slice operator for this. Let us first create a collection with documents −> db.firstElementOfArray.insertOne( ...    { ...       _id: 100, ...       "Details": [ ...          { ...             "CustomerName": "John", ...     ... Read More

How can you upload a file using JSP?

karthikeya Boyini

karthikeya Boyini

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

402 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 ... Read More

Java Tuples addAtX() method for Pair class

karthikeya Boyini

karthikeya Boyini

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

56 Views

The addAtX() method is used to add value at a particular position represented by X here.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Here we have also used the Triplet class, therefore ... Read More

Is RowSet Scrollable? Explain with an example?

karthikeya Boyini

karthikeya Boyini

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

354 Views

A RowSet object is similar to ResultSet, it also stores tabular data, in addition to the features of a ResultSet. A RowSet follows the JavaBeans component model.If you Retrieve a ResultSet object by default the cursor of it moves only in forward direction. i.e. you can retrieve the contents of ... Read More

Java 8 Clock fixed() method

karthikeya Boyini

karthikeya Boyini

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

335 Views

The fixed instant on the clock can be obtained using the method fixed() in the Clock Class in Java. This method requires two parameters i.e. the fixed instant and the time zone. Also, it returns the fixed instant on the clock. The fixed() method is normally used for testing purposes.A ... Read More

Advertisements