Found 9150 Articles for Object Oriented Programming

What are JSTL Core tags in JSP?

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

320 Views

The core group of tags is the most commonly used JSTL tags. Following is the syntax to include the JSTL Core library in your JSP −Following table lists out the core JSTL Tags −S.No.Tag & Description1Like , but for expressions.2Sets the result of an expression evaluation in a 'scope'3Removes a scoped variable (from a particular scope, if specified).4Catches any Throwable that occurs in its body and optionally exposes it.5Simple conditional tag which evalutes its body if the supplied condition is true.6Simple conditional tag that establishes a context for mutually exclusive conditional operations, marked by and .7Subtag of that ... Read More

How can we set time in a table in JDBC?

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

321 Views

You can insert time values in SQL using the time datatype, The java.sql.Time class maps to the SQL Time type.The PreparedStatement interface provides a method named setTime(). Using this you can insert time 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 Time object representing the time value to be passed. The constructor of java.sql.Time 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 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

7K+ 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

762 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

549 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

354 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

215 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

1K+ 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

1K+ 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

Advertisements