Found 9326 Articles for Object Oriented Programming

What is TYPE_SCROLL_INSENSITIVE ResultSet in JDBC?

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

2K+ Views

This represents a scrollable ResultSet i.e. the cursor moves in forward or backward directions. This type of ResultSet is insensitive to the changes that are made in the database i.e. the modifications done in the database are not reflected in the ResultSet.Which means if we have established a connection with a database using JDBC program and retrieved a ResultSet holding all the records in a table named SampleTable and, meanwhile if we add some more records to the table (after retrieving getting the ResultSet), these recent changes will not be reflected in the ResultSet object we previously obtained.ExampleConsider we have ... Read More

What is Type_FORWARD_ONLY ResultSet in JDBC?

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

3K+ Views

A ResultSet interface in JDBC represents the tabular data generated by SQL queries. It has a cursor which points to the current row. Initially, this cursor is positioned before the first row.You can retrieve the column value at the current row using the getter methods getInt(), getString(), getDate() etc…To move the cursor and to navigate/iterate through the ResultSet the java.sql.ResultSet interface provides various methods such as next(), Previous(), first(), last(), relative(), absolute(), beforeFirst(), afterLast() etc...Type_FORWARD_ONLY Only ResultSetIn forward only ResultSet you can move the cursor only in forward direction. By default, a ResultSet is of type forward only.Read More

How to check index within a string of a specified substring in JSP?

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

354 Views

The fn:indexOf() function returns the index within a string of a specified substring.SyntaxThe fn:indexOf() function has the following syntax −int indexOf(java.lang.String, java.lang.String)ExampleFollowing is the example to explain the functionality of the fn:indexOf() function − Using JSTL Functions Index (1) : ${fn:indexOf(string1, "first")} Index (2) : ${fn:indexOf(string2, "second")} You will receive the following result −Index (1) : 8 Index (2) : 13

How to escape characters that can be interpreted as XML markup in JSP?

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

819 Views

The fn:escapeXml() function escapes characters that can be interpreted as XML markup.SyntaxThe fn:escapeXml() function has the following syntax −java.lang.String escapeXml(java.lang.String)ExampleFollowing is the example to explain the functionality of the fn:escapeXml() function − Using JSTL Functions With escapeXml() Function: string (1) : ${fn:escapeXml(string1)} string (2) : ${fn:escapeXml(string2)} Without escapeXml() Function: string (1) : ${string1} string (2) : ${string2} You will receive the following result −With escapeXml() Function: string (1) : This is first String. string (2) : This is second String. Without escapeXml() Function − string (1) : This is first String. string (2) : This is second String.

How to determine if an input string ends with a specified suffix in JSP?

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

212 Views

The fn:endsWith() function determines if an input string ends with a specified suffix.SyntaxThe fn:endsWith() function has the following syntax −boolean endsWith(java.lang.String, java.lang.String)ExampleFollowing example explains the functionality of the fn:substring function −           Using JSTL Functions                              String ends with 123                      String ends with TEST       You will receive the following result −String ends with 123

How to check whether an input string contains a specified substring ignoring the case using JSP?

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

257 Views

The fn:containsIgnoreCase() function determines whether an input string contains a specified substring. While doing search it ignores the case.SyntaxThe fn:containsIgnoreCase() function has the following syntax −boolean containsIgnoreCase(java.lang.String, java.lang.String)ExampleFollowing is the example to explain the functionality of the fn:containsIgnoreCase() function −           Using JSTL Functions                              Found test string                      Found TEST string         You will receive the following result −Found test string Found TEST string

How to check if an input string contains a specified substring in JSP?

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

2K+ Views

The fn:contains() function determines whether an input string contains a specified substring.SyntaxThe fn:contains() function has the following syntax −boolean contains(java.lang.String, java.lang.String)ExampleFollowing example explains the functionality of fn:contains() function −           Using JSTL Functions     Found test string Found TEST string You will receive the following result −Found test string

How to apply XSL transformation on an XML document?

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

381 Views

The tag applies an XSL transformation on an XML document.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultdocSource XML document for the XSLT transformationNoBodydocSystemIdURI of the original XML documentNoNonexsltXSLT stylesheet providing transformation instructionsYesNonexsltSystemIdURI of the original XSLT documentNoNoneresultResult object to accept the transformation's resultNoPrint to pagevarVariable that is set to the transformed XML documentNoPrint to pagescopeScope of the variable to expose the transformation's resultNoNoneExampleConsider the following XSLT stylesheet style.xsl −                                                                                                                                                                                                                                                                     Now consider the following JSP file −           JSTL x:transform Tags               Books Info:                                                 Padam History                 ZARA                 100                                             Great Mistry                 NUHA                 2000                                 You will receive the following result −Books InfoPadam HistoryZARA100Great MistryNUHA2000

Can we have a switch statement in JSP for XPath expression?

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

276 Views

The tag works like a Java switch statement. With this, you can choose between a number of alternatives. Where the switch statement has the case statements, the tag has the tags. In a similar way, a switch statement has the default clause to specify a default action and the tag has the tag as the default clause.AttributeThe tag does not have any attribute.The tag has one attributes which is listed below.The tag does not have any attribute.The tag has the following attributes −AttributeDescriptionRequiredDefaultselectCondition to evaluateYesNoneExample         ... Read More

How to handle Exceptions while working with JDBC applications?

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

137 Views

Whenever a JDBC application encounters an issue while executing SQL statements an SQLException is thrown.This class provides information on the errors that occur while interacting with the database.Following are the main methods of the SQLException class:Sr.NoMethod & Description1int getErrorCode()This method returns the exception code for the Exception occurred.2SQLException setNextException(SQLException ex)Using this method you can create a chain of exceptions by adding a new exception to the current exception.3String getSQLState()This method returns the SQLState of the current exception.4Iterator iterator()This method returns an iterator to iterate through the chain of SQLExceptions.5void getNextException(SQLException ex)This method is used to retrieve next SQLException in this ... Read More

Advertisements