How to print result of a java expression in JSP?

Samual Sam
Updated on 30-Jul-2019 22:30:25
The tag displays the result of an expression. This is almost similar to the way works. The difference here is that tag lets you use the simpler "." notation to access properties. For example, to access customer.address.street, use the tag  .The tag can automatically escape XML tags so they aren't evaluated as actual tags.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueInformation to outputYesNonedefaultFallback information to outputNobodyescapeXmlTrue if the tag should escape special XML charactersNotrueExample Tag Example The above code will generate the following result − , &

LocalDate minusMonths() Method in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
An immutable copy of the LocalDate where the months are subtracted from it can be obtained using the minusMonths() method in the LocalDate class in Java. This method requires a single parameter i.e. the number of months to be subtracted and it returns the instant with the subtracted months.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { LocalDate ld1 = LocalDate.parse("2019-02-14"); System.out.println("The LocalDate is: " + ld1); ... Read More

DoubleStream allMatch() method in Java

Anvi Jain
Updated on 30-Jul-2019 22:30:25
The allMatch() method in the DoubleStream class returns whether all elements of this stream match the provided predicate.The syntax is as follows −boolean allMatch(DoublePredicate predicate)Here, the argument predicate is a stateless predicate to apply to elements of this stream. The DoublePredicate is a predicate of one double-valued argument.To use the DoubleStream class in Java, import the following package −import java.util.stream.DoubleStream;Create DoubleStream and add some elements −DoubleStream doubleStream = DoubleStream.of(15.8, 28.7, 35.7, 48.1, 78.9);Now, check whether the condition is TRUE for elements of the stream −boolean res = doubleStream.allMatch(num -> num > 10); The following is an example to implement DoubleStream ... Read More

Find Strings greater than a particular length in MongoDB?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25
To find the string which has a length greater than a particular value in MongoDB, use the $where operator. The syntax is as follows −db.yourCollectionName.find({$where:'this.yourStringFieldName.length > yourIntegerValue'}).pretty();To understand the above concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.stringFieldLengthDemo.insertOne({"UserId":1, "UserName":"Adam Smith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c77bb4b2386c62d05142a78") } > db.stringFieldLengthDemo.insertOne({"UserId":2, "UserName":"Carol Taylor"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c77bb562386c62d05142a79") } > db.stringFieldLengthDemo.insertOne({"UserId":3, "UserName":"James Brown"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c77bb5b2386c62d05142a7a") } > db.stringFieldLengthDemo.insertOne({"UserId":4, "UserName":"John Smith"}); {    "acknowledged" ... Read More

How to avoid inserting duplicate rows in MySQL?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
To avoid inserting duplicate rows in MySQL, you can use UNIQUE(). The syntax is as follows −ALTER TABLE yourTableName ADD UNIQUE(yourColumnName1, yourColumnName2, ...N);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table avoidInsertingDuplicateRows    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> FirstValue int,    -> SecondValue int    -> ); Query OK, 0 rows affected (0.53 sec)Now check the description of table using desc command. The query is as follows −mysql> desc avoidInsertingDuplicateRows;Sample The following is The output −+-------------+---------+------+-----+---------+----------------+ | Field       ... Read More

fabs() in C++

Chandu yadav
Updated on 30-Jul-2019 22:30:25
The C or C++ library function double fabs(double x) returns the absolute value of x. x − This is the floating point value. This function returns the absolute value of x. Following is the declaration for fabs() function.double fabs(double x)The following example shows the usage of fabs() function.Example Live Demo#include #include using namespace std; int main () {    int a, b;    a = 1234;    b = -344;    cout

C++ Program to Implement Fusion Tree

Anvi Jain
Updated on 30-Jul-2019 22:30:25
A fusion tree is a tree data structure that implements an associative array on w-bit integers. This is a C++ Program to Implement Fusion Tree Which generated an array of 6-bit integers on given binary tree as input.AlgorithmRequired functions and inputs −Begin    Take the no of elements of the tree and take the elements.    Create a structure FusionTree to declare variables.    Create a function init() for creating the nodes.    Create a function traverse() to traverse the tree.    Create a function sort() to sort the nodes of the tree.    Create a function split_child() to split ... Read More

Update two separate arrays in a document with one update call in MongoDB?

George John
Updated on 30-Jul-2019 22:30:25
You can use $push operator for this. Let us first create a collection with documents>db.twoSeparateArraysDemo.insertOne({"StudentName":"Larry", "StudentFirstGameScore":[98], "StudentSecondGameScore":[77]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b152815e86fd1496b38b8") } >db.twoSeparateArraysDemo.insertOne({"StudentName":"Mike", "StudentFirstGameScore":[58], "StudentSecondGameScore":[78]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b152d15e86fd1496b38b9") } >db.twoSeparateArraysDemo.insertOne({"StudentName":"David", "StudentFirstGameScore":[65], "StudentSecondGameScore":[67]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b153315e86fd1496b38ba") }Following is the query to display all documents from a collection with the help of find() method> db.twoSeparateArraysDemo.find().pretty();This will produce the following output{    "_id" : ObjectId("5c9b152815e86fd1496b38b8"),    "StudentName" : "Larry",    "StudentFirstGameScore" : [       98    ],    "StudentSecondGameScore" : [       ... Read More

How to sort List in descending order using Comparator in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25
Let us first create an ArrayList −ArrayListarrList = new ArrayList(); arrList.add(10); arrList.add(50); arrList.add(100); arrList.add(150); arrList.add(250);Use Comparators interface to order in reverse order with reverseOrder() −Comparator comparator = Collections.reverseOrder(); Now, sort with Collections: Collections.sort(arrList, comparator);Example Live Demoimport java.util.ArrayList; import java.util.Collections; import java.util.Comparator; public class Demo {    public static void main(String[] args) {       ArrayListarrList = new ArrayList();       arrList.add(10);       arrList.add(50);       arrList.add(100);       arrList.add(150);       arrList.add(250);       arrList.add(100);       arrList.add(150);       arrList.add(250);       Comparator comparator = Collections.reverseOrder();       ... Read More

enum vs. const vs. #define in C/C++

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25
Here we will see what are the differences between enum, const and the #define in C or C++ programs. These three creates some confusion while we have to take the decision for choosing them. Now let us see what are these three things.const or static constThe const is constant type data, or static const is constant but storage specifier is static. So it will remain active until the program is terminated, and constant type data cannot be updated.Example#include using namespace std; main() {    int x;    x = 65700;    cout
Advertisements