Found 9326 Articles for Object Oriented Programming

How to retrieve Date from a table in JDBC?

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

4K+ Views

The ResultSet interface provides a method named getDate() this method accepts an integer parameter representing the index of the column, (or, a String parameter representing the name of the column) from which you need to retrieve the date value. To retrieve date value from a table −Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Connect to the database using the getConnection() method of the DriverManager class. Passing URL (String), username (String), password (String) as parameters to it.Create a Statement object using the createStatement() method of the Connection interface.Execute ... Read More

How to insert Date value into table in JDBC?

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

6K+ Views

You can insert date values in SQL using the date datatype, The java.sql.Date class maps to the SQL DATE type.The PreparedStatement interface provides a method named setDate(). Using this you can insert date into a table. This method accepts two parameters −An integer representing the parameter index of the place holder (?) to which we need to set date value.a Date object representing the date value to be passed. The constructor of java.sql.Date class accepts a variable of long type representing the number of milliseconds from the epoch (standard base time I.e. January 1, 1970, 00:00:00 GMT).ExampleAssume we have created ... Read More

How to set time zone in a JSP?

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

529 Views

The tag is used to copy a time zone object into the specified scoped variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueTime zone to expose as a scoped or configuration variableYesNonevarName of the variable to store the new time zoneNoReplace defaultscopeScope of the variable to store the new time zoneNoPageExample JSTL fmt:setTimeZone Tag Date in Current Zone: Change Time Zone to GMT-8 Date in Changed Zone: The above code will generate the following result −Date in Current Zone: 23 September 2010 15:21:37 GST Change Time Zone to GMT-8 Date in Changed Zone: 23 September 2010 03:21:37 GMT-08:00

How to use time zone in a JSP?

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

368 Views

The tag is used to specify the time zone that all tags within its body will use.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueTime zone to apply to the bodyYesNoneExample           JSTL fmt:timeZone Tag                                                                                                  Formatting:                                                                                                                                                                                                                                                                 The above code will generate the following result −Formatting: 23 September 2010 15:09:09 GST Etc/GMT+1222-Sep-2010 23:09:09Etc/GMT+1123-Sep-2010 00:09:09

How to use multiple resource bundle in same JSP?

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

233 Views

The tag is used to load a resource bundle and stores it in the named scoped variable or the bundle configuration variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultbasenameBase name of the resource bundle family to expose as a scoped or a configuration variableYesNonevarName of the variable to store the new bundleNoReplace defaultscopeScope of the variable to store the new bundleNoPageExample           JSTL fmt:setBundle Tag                     The above code will generate the following result −One Two Three

How to set locate to identify required resource bundle in JSP?

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

141 Views

The tag is used to store the given locale in the locale configuration variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueSpecifies a two-part code that represents the ISO-639 language code and an ISO-3166 country code.Yesen_USvariantBrowser-specific variantNoNonescopeScope of the locale configuration variableNoPageExampleResource bundles contain locale-specific objects. Resource bundles contain key/value pairs. When your program needs a locale-specific resource, you keep all the keys common to all the locale but you can have translated values specific to locale. Resource bundles helps in providing content specific to locale.A Java resource bundle file contains a series of key-to-string mappings. The method that we ... Read More

How to use resource bundle in JSP?

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

995 Views

The tag will make the specified bundle available to all tags that occur between the bounding and tags. With this, you need not specify the resource bundle for each of your tags.For example, the following two blocks will produce the same output − AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultbasenameSpecifies the base name of the resource bundle that is to be loaded.YesNonePrefixValue to prepend to each key name in subtagsNoNoneExampleResource bundles contain locale-specific objects. Resource bundles contain key/value pairs. When your program ... Read More

How to parse date in JSP?

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

700 Views

The tag is used to parse dates.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueDate value to read (parse)NoBodytypeDATE, TIME, or BOTHNodatedateStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNoDefaulttimeStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNoDefaultparseLocaleLocale to use when parsing the dateNoDefault localepatternCustom parsing patternNoNonetimeZoneTime zone of the parsed dateNoDefault time zonevarName of the variable to store the parsed dateNoPrint to pagescopeScope of the variable to store the formatted dateNopageA 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 format date in JSP?

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

4K+ Views

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

How to parse currencies in JSP?

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

169 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

Advertisements