How to use <jsp:setProperty> action in JSP?

Ankith Reddy
Updated on 30-Jul-2019 22:30:25
The setProperty action sets the properties of a Bean. The Bean must have been previously defined before this action. There are two basic ways to use the setProperty action −You can use jsp:setProperty after, but outside of a jsp:useBean element, as given below − ... In this case, the jsp:setProperty is executed regardless of whether a new bean was instantiated or an existing bean was found.A second context in which jsp:setProperty can appear is inside the body of a jsp:useBean element, as given below − ... Here, the jsp:setProperty is executed only if ... Read More

How to format date in JSP?

Samual Sam
Updated on 30-Jul-2019 22:30:25
The tag is used to format dates in a variety of ways.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueDate value to displayYesNonetypeDATE, TIME, or BOTHNodatedateStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNodefaulttimeStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNodefaultpatternCustom formatting patternNoNonetimeZoneTime zone of the displayed dateNoDefault time zonevarName of the variable to store the formatted dateNoPrint to pagescopeScope of the variable to store the formatted dateNopageThe pattern attribute is used to specify even more precise handling of the date −CodePurposeSampleGThe era designatorADyThe year2002MThe monthApril & 04dThe day of the month20hThe hour(12-hour time)12HThe hour(24-hour time)0mThe minute45sThe second52SThe millisecond970EThe day of the weekTuesdayDThe day of ... Read More

LocalDate getEra() method in Java

Samual Sam
Updated on 30-Jul-2019 22:30:25
The era for a particular LocalDate can be obtained using the getEra() method in the LocalDate class in Java. This method requires no parameters and it returns the era applicable for the LocalDate.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalDate ld = LocalDate.parse("2019-02-14"); System.out.println("The LocalDate is: " + ld); System.out.println("The era is: " + ld.getEra()); } }OutputThe LocalDate is: 2019-02-14 The ... Read More

What is the setAtX() method of the Ennead Tuple in Java

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25
To set Ennead value in Java, you need to use the setAtX() method. Here, X represents the index wherein you need to set the value i.e. for index 1, use setAt1() method. Set the value as the parameter value of the method.Let us first see what we need to work with JavaTuples. To work with Ennead class in JavaTuples, you need to import the following package −import org.javatuples.Ennead;Note − Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the ... Read More

C++ Program to Implement Adjacency Matrix

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25
The adjacency matrix of a graph is a square matrix of size V x V. The V is the number of vertices of the graph G. In this matrix in each side V vertices are marked. If the graph has some edges from i to j vertices, then in the adjacency matrix at ith row and jth column it will be 1 (or some non-zero value for weighted graph), otherwise that place will hold 0.The complexity of Adjacency Matrix representation:The adjacency matrix representation takes O(V2) amount of space while it is computed. When graph has maximum number of edges and ... Read More

Add DATE and TIME fields to get DATETIME field in MySQL?

Chandu yadav
Updated on 30-Jul-2019 22:30:25
You can use CONCAT() function to set date and time fields to get DATETIME field.Let us create a demo tablemysql> create table getDateTimeFieldsDemo -> ( -> ShippingDate date, -> ShippingTime time, -> Shippingdatetime datetime -> ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into getDateTimeFieldsDemo(ShippingDate, ShippingTime) values('2018-01-21', '09:45:34'); Query OK, 1 row affected (0.16 sec) mysql> insert into getDateTimeFieldsDemo(ShippingDate, ShippingTime) values('2013-07-26', '13:21:20'); Query OK, 1 row affected (0.13 sec) mysql> ... Read More

Read file line by line using C++

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
This is a C++ program to read file line by line.Inputtpoint.txt is having initial content as “Tutorials point.”OutputTutorials point.AlgorithmBegin    Create an object newfile against the class fstream.    Call open() method to open a file “tpoint.txt” to perform write operation using object newfile.    If file is open then       Input a string “Tutorials point" in the tpoint.txt file.       Close the file object newfile using close() method.    Call open() method to open a file “tpoint.txt” to perform read operation using object newfile.    If file is open then       Declare a ... Read More

Stack Unwinding in C++

Nancy Den
Updated on 30-Jul-2019 22:30:25
Here we will see what is the meaning of stack unwinding. When we call some functions, it stores the address into call stack, and after coming back from the functions, pops out the address to start the work where it was left of.The stack unwinding is a process where the function call stack entries are removed at runtime. To remove stack elements, we can use exceptions. If an exception is thrown from the inner function, then all of the entries of the stack is removed, and return to the main invoker function.Let us see the effect of stack unwinding through ... Read More

How to handle orientation change android?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25
This example demonstrate about How to handle orientation change androidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken text view to show orientation changes.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView actionEvent;    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)    @Override    protected void onCreate(Bundle ... Read More

Java Program to shift array elements to the right

Samual Sam
Updated on 30-Jul-2019 22:30:25
Let us first create an int array −int[] arr = { 10, 20, 30, 40, 50, 60, 70, 80, 90 };Now, shift array elements to the right with arraycopy() and placing the elements correctly so that it gets shifted to the right −System.arraycopy(arr, 0, arr, 1, arr.length - 1);Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String[] argv) throws Exception {       int[] arr = { 10, 20, 30, 40, 50, 60, 70, 80, 90 };       System.out.println("Initial array...\n"+Arrays.toString(arr));       System.arraycopy(arr, 0, arr, 1, arr.length - 1);       System.out.println("Array after shifting to the right...");       System.out.println(Arrays.toString(arr));    } }OutputInitial array... [10, 20, 30, 40, 50, 60, 70, 80, 90] Array after shifting to the right... [10, 10, 20, 30, 40, 50, 60, 70, 80]
Advertisements