Found 177 Articles for JSP

How to execute UPDATE SQL in a JSP?

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

1K+ Views

The tag executes an SQL statement that does not return data; for example, SQL INSERT, UPDATE, or DELETE statements.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultsqlSQL command to execute (should not return a ResultSet)NoBodydataSourceDatabase connection to use (overrides the default)NoDefault databasevarName of the variable to store the count of affected rowsNoNonescopeScope of the variable to store the count of affected rowsNoPageExampleTo start with basic concept, let us create a simple table Employees table in the TEST database and create few records in that table as follows −Step 1Open a Command Prompt and change to the installation directory as follows ... Read More

How to execute SQL update query in a JSP?

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

343 Views

The tag executes an SQL statement that does not return data; for example, SQL INSERT, UPDATE, or DELETE statements.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultsqlSQL command to execute (should not return a ResultSet)NoBodydataSourceDatabase connection to use (overrides the default)NoDefault databasevarName of the variable to store the count of affected rowsNoNonescopeScope of the variable to store the count of affected rowsNoPageExampleTo start with basic concept, let us create a simple table Employees table in the TEST database and create few records in that table as follows −Step 1Open a Command Prompt and change to the installation directory as follows ... Read More

How to executes an SQL SELECT statement in a JSP?

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

2K+ Views

The tag executes an SQL SELECT statement and saves the result in a scoped variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultsqlSQL command to execute (should return a ResultSet)NoBodydataSourceDatabase connection to use (overrides the default)NoDefault databasemaxRowsMaximum number of results to store in the variableNoUnlimitedstartRowNumber of the row in the result at which to start recordingNo0varName of the variable to represent the databaseNoSet defaultscopeScope of variable to expose the result from the databaseNoPageExampleTo start with the basic concept, let us create an Employees table in the TEST database and create few records in that table as follows −Follow these steps ... Read More

How to set the data source in a JSP?

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

391 Views

The tag sets the data source configuration variable or saves the data-source information in a scoped variable that can be used as input to the other JSTL database actions.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultdriverName of the JDBC driver class to be registeredNoNoneurlJDBC URL for the database connectionNoNoneuserDatabase usernameNoNonepasswordDatabase passwordNoNonepasswordDatabase passwordNoNonedataSourceDatabase prepared in advanceNoNonevarName of the variable to represent the databaseNoSet defaultscopeScope of the variable to represent the databaseNoPageExampleConsider the following information about your MySQL database setup −We are using JDBC MySQL driver.We are going to connect to TEST database on local machine.We would use user_id and my ... Read More

Which library can be used to interact with database in JSP?

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

136 Views

The JSTL SQL tag library provides tags for interacting with relational databases (RDBMSs) such as Oracle, MySQL, or Microsoft SQL Server.Following is the syntax to include JSTL SQL library in your JSP −Following table lists out the SQL JSTL Tags −S.No.Tag & Description1Creates a simple DataSource suitable only for prototyping2Executes the SQL query defined in its body or through the sql attribute.3Executes the SQL update defined in its body or through the sql attribute.4Sets a parameter in an SQL statement to the specified value.5Sets a parameter in an SQL statement to the specified java.util.Date value.6Provides nested database action elements with ... Read More

How to specify the encoding type used by forms that post data back to the Web application in a JSP?

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

229 Views

The tag is used to specify the encoding type used by forms that post data back to the Web application.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultkeyName of character encoding you want to apply when decoding request parameters.YesNoneYou use the tag when you want to specify the character encoding for decoding data posted from forms. This tag must be used with character encodings that are different from ISO-8859-1. The tag is required since most browsers do not include a Content-Type header in their requests.The purpose of the tag is to specify the content type of the request. ... Read More

How to maps key to the localized message and performs the parametric replacement in a JSP?

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

129 Views

The tag maps key to the localized message and performs the parametric replacement.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultkeyMessage key to retrieveNoBodybundleResource bundle to useNoDefault bundlevarName of the variable to store the localized messageNoPrint to pagescopeThe scope of the variable to store the localized messageNoPageExample JSTL fmt:message Tag You will receive the following result −One Two Three

What are JSTL Core tags in JSP?

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

220 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 to set time zone in a JSP?

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

471 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

329 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

Advertisements