Found 4336 Articles for Java 8

How can we retrieve a blob datatype from a table using the getBinaryStream() method in JDBC?

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

464 Views

The ResultSet interface provides the method named getBlob() to retrieve blob datatype from a table in the database. In addition to this, it also provides a method named getBinaryStream()Like getBlob() this method also accepts an integer representing the index of the column (or, a String value representing the name of the column) and retrieves the value at the specified column. The difference is unlike the getBlob() method (which returns a Blob object) this method returns an InputStream object which holds the contents of the blob datatype in the form of un-interpreted bytes.ExampleAssume we have created a table named MyTable in ... Read More

How to parse percentages in JSP?

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

275 Views

The tag is used to parse numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to read (parse)NoBodytypeNUMBER, CURRENCY, or PERCENTNonumberparseLocaleLocale to use when parsing the numberNoDefault localeintegerOnlyWhether to parse to an integer (true) or floating-point number (false)NofalsepatternCustom parsing patternNoNonetimeZoneTime zone of the displayed dateNoDefault time zonevarName of the variable to store the parsed numberNoPrint to pagescopeScope of the variable to store the formatted numberNopageA pattern attribute is provided that works just like the pattern attribute for the tag. However, in the case of parsing, the pattern attribute tells the parser what format to expect.Example ... Read More

How to parse number in JSP?

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

610 Views

The tag is used to parse numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to read (parse)NoBodytypeNUMBER, CURRENCY, or PERCENTNonumberparseLocaleLocale to use when parsing the numberNoDefault localeintegerOnlyWhether to parse to an integer (true) or floating-point number (false)NofalsepatternCustom parsing patternNoNonetimeZoneTime zone of the displayed dateNoDefault time zonevarName of the variable to store the parsed numberNoPrint to pagescopeScope of the variable to store the formatted numberNopageA pattern attribute is provided that works just like the pattern attribute for the tag. However, in the case of parsing, the pattern attribute tells the parser what format to expect.Example ... Read More

Write an JDBC example for inserting value for Blob datatype into a table?

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

2K+ Views

Assume we already have a table named MyTable in the database with the following description.+-------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+---------+-------+ | Name | varchar(255) | YES | | NULL | | | image | blob | YES | | NULL | | +-------+--------------+------+-----+---------+-------+If you need to ... Read More

How to format currencies in JSP?

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

1K+ Views

The tag is used to format numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to displayYesNonetypeNUMBER, CURRENCY, or PERCENTNoNumberpatternSpecify a custom formatting pattern for the output.NoNonecurrencyCodeCurrency code (for type = "currency")NoFrom the default localecurrencySymbolCurrency symbol (for type = "currency")NoFrom the default localegroupingUsedWhether to group numbers (TRUE or FALSE)NotruemaxIntegerDigitsMaximum number of integer digits to printNoNoneminIntegerDigitsMinimum number of integer digits to printNoNonemaxFractionDigitsMaximum number of fractional digits to printNoNoneminFractionDigitsMinimum number of fractional digits to printNoNonevarName of the variable to store the formatted numberNoPrint to pagescopeScope of the variable to store the formatted numberNopageExample       ... Read More

How to insert images in Database using JDBC?

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

4K+ Views

The setBinaryStream() method of the PreparedStatement interface accepts an integer representing the index of the parameter and an InputStream object and sets the parameter to the given InputStream object. Whenever you need to send very large binary value you can use this method.And SQL databases provide a datatype named Blob (Binary Large Object) in this you can store large binary data like images.Storing image using JDBCIf you need to store an image in a database using the JDBC program create a table with a Blob datatype as shown below:CREATE TABLE Tutorial(Name VARCHAR(255), Type INT NOT NULL, Logo BLOB);Now, using JDBC, connect ... Read More

How to format percentages in JSP?

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

461 Views

The tag is used to format numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to displayYesNonetypeNUMBER, CURRENCY, or PERCENTNoNumberpatternSpecify a custom formatting pattern for the output.NoNonecurrencyCodeCurrency code (for type = "currency")NoFrom the default localecurrencySymbolCurrency symbol (for type = "currency")NoFrom the default localegroupingUsedWhether to group numbers (TRUE or FALSE)NotruemaxIntegerDigitsMaximum number of integer digits to printNoNoneminIntegerDigitsMinimum number of integer digits to printNoNonemaxFractionDigitsMaximum number of fractional digits to printNoNoneminFractionDigitsMinimum number of fractional digits to printNoNonevarName of the variable to store the formatted numberNoPrint to pagescopeScope of the variable to store the formatted numberNopageExample ... Read More

How to format number in JSP?

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

2K+ Views

The tag is used to format numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to displayYesNonetypeNUMBER, CURRENCY, or PERCENTNoNumberpatternSpecify a custom formatting pattern for the output.NoNonecurrencyCodeCurrency code (for type = "currency")NoFrom the default localecurrencySymbolCurrency symbol (for type = "currency")NoFrom the default localegroupingUsedWhether to group numbers (TRUE or FALSE)NotruemaxIntegerDigitsMaximum number of integer digits to printNoNoneminIntegerDigitsMinimum number of integer digits to printNoNonemaxFractionDigitsMaximum number of fractional digits to printNoNoneminFractionDigitsMinimum number of fractional digits to printNoNonevarName of the variable to store the formatted numberNoPrint to pagescopeScope of the variable to store the formatted numberNopageExample       ... Read More

What are JSTL formatting tags in JSP?

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

397 Views

The JSTL formatting tags are used to format and display text, the date, the time, and numbers for internationalized Websites. Following is the syntax to include Formatting library in your JSP −Following table lists out the Formatting JSTL Tags −S.No.Tag & Description1: To render numerical value with specific precision or format.2: Parses the string representation of a number, currency, or percentage.3: Formats a date and/or time using the supplied styles and pattern.4: Parses the string representation of a date and/or time5: Loads a resource bundle to be used by its tag body.6: Stores the given locale in the locale configuration variable.7: Loads a resource bundle and ... Read More

What is the use of tag in JSP?

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

347 Views

The tag formats a URL into a string and stores it into a variable. This tag automatically performs URL rewriting when necessary. The var attribute specifies the variable that will contain the formatted URL.The JSTL url tag is just an alternative method of writing the call to the response.encodeURL() method. The only real advantage the url tag provides is proper URL encoding, including any parameters specified by children param tag.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueBase URLYesNonecontext/ followed by the name of a local web applicationNoCurrent applicationvarName of the variable to expose the processed URLNoPrint to pagescopeScope of ... Read More

Advertisements