Found 9297 Articles for Object Oriented Programming

How a JSP page works. Can somebody explains the JSP architecture in simpler terms

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

627 Views

The web server needs a JSP engine, i.e, a container to process JSP pages. The JSP container is responsible for intercepting requests for JSP pages. This tutorial makes use of Apache which has built-in JSP container to support JSP pages development.A JSP container works with the Web server to provide the runtime environment and other services a JSP needs. It knows how to understand the special elements that are part of JSPs.Following diagram shows the position of JSP container and JSP files in a Web application.JSP ProcessingThe following steps explain how the web server creates the Webpage using JSP −As ... Read More

How to setup a Web server like Tomcat to test JSP pages?

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

798 Views

Apache Tomcat is an open source software implementation of the JavaServer Pages and Servlet technologies and can act as a standalone server for testing JSP and Servlets, and can be integrated with the Apache Web Server. Here are the steps to set up Tomcat on your machine −Download the latest version of Tomcat from https://tomcat.apache.org/.Once you downloaded the installation, unpack the binary distribution into a convenient location. For example, in C:\apache-tomcat-5.5.29 on windows, or /usr/local/apache-tomcat-5.5.29 on Linux/Unix and create CATALINA_HOME environment variable pointing to these locations.Tomcat can be started by executing the following commands on the Windows machine −%CATALINA_HOME%\bin\startup.bat ... Read More

What are advantages of using JSP?

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

3K+ Views

Following table lists out the other advantages of using JSP over other technologies −vs. Active Server Pages (ASP)The advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual Basic or other MS specific language, so it is more powerful and easier to use. Second, it is portable to other operating systems and non-Microsoft Web servers.vs. Pure ServletsIt is more convenient to write (and to modify!) regular HTML than to have plenty of println statements that generate the HTML.vs. Server-Side Includes (SSI)SSI is really only intended for simple inclusions, not for "real" programs that use form ... Read More

What is Java Server Pages, JSP? Why JSP is preferred over CGI?

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

987 Views

JavaServer Pages (JSP) is a technology for developing Webpages that support dynamic content. This helps developers insert java code in HTML pages by making use of special JSP tags, most of which start with .A JavaServer Pages component is a type of Java servlet that is designed to fulfill the role of a user interface for a Java web application. Web developers write JSPs as text files that combine HTML or XHTML code, XML elements, and embedded JSP actions and commands.Using JSP, you can collect input from users through Webpage forms, present records from a database or another source, and ... Read More

How to write a JDBC program to extract data from multiple databases?

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

985 Views

To connect with a data base, you need toRegister the DriverSelect the required database register the Driver class of the particular database using the registerDriver() method of the DriverManager class or, the forName() method of the class named Class.DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get connectionCreate a connection object by passing the URL of the database, username and password of a user in the database (in string format) as parameters to the getConnection() method of the DriverManager class.Connection mysqlCon = DriverManager.getConnection(mysqlUrl, "root", "password");And, to extract data you need to execute the select query as:ResultSet rs = stmt.executeQuery("Select * from Employee");To print the contents of the ... Read More

How to write a JDBC application which connects to multiple databases simultaneously?

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

5K+ Views

To connect with a database, you need toRegister the Driver: Select the required database, register the Driver class of the particular database using the registerDriver() method of the DriverManager class or, the forName() method of the class named Class.DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get connection: Create a connection object by passing the URL of the database, username and password (of a user in the database) in string format, as parameters to the getConnection() method of the DriverManager class.Connection mysqlCon = DriverManager.getConnection(mysqlUrl, "root", "password");To connect to multiple databases in a single JDBC program you need to connect to the two (or more) databases simultaneously using ... Read More

What are bind variables? How to execute a query with bind variables using JDBC?

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

6K+ Views

A bind variable is an SQL statement with a temporary variable as place holders which are later replaced with appropriate values. For example, if you have a table named employee in the database created as shown below:+---------+--------+----------------+ | Name | Salary | Location | +---------+--------+----------------+ | Amit | 30000 | Hyderabad | | Kalyan | 40000 | Vishakhapatnam | | Renuka | 50000 | Delhi | | Archana | ... Read More

What are the types of statements in JDBC?

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

10K+ Views

There are three types of statements in JDBC namely, Statement, Prepared Statement, Callable statement.StatementThe Statement interface represents the static SQL statement. It helps you to create a general purpose SQL statements using Java.Creating a statementYou can create an object of this interface using the createStatement() method of the Connection interface.Create a statement by invoking the createStatement() method as shown below.Statement stmt = null; try { stmt = conn.createStatement( ); . . . } catch (SQLException e) { . . . } finally { . . . }Executing the ... Read More

What are the main classes and interfaces of JDBC?

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

11K+ Views

JDBC API is available in two packages java.sql, core API and javax.sql JDBC optional packages. Following are the important classes and interfaces of JDBC.Class/interfaceDescriptionDriverManagerThis class manages the JDBC drivers. You need to register your drivers to this.It provides methods such as registerDriver() and getConnection().DriverThis interface is the Base interface for every driver class i.e. If you want to create a JDBC Driver of your own you need to implement this interface. If you load a Driver class (implementation of this interface), it will create an instance of itself and register with the driver manager.StatementThis interface represents a static SQL statement. ... Read More

How to establish connection with JDBC?

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

1K+ Views

To connect with a database, you need to follow the steps given below:Step1: Register the driver: To develop a basic JDBC application, first of all, you need to register the driver with the DriverManager.You can register a driver in two ways, one is using registerDriver() method of the DriverManager class and, using forName() method of the class named Class.The registerDriver() method accepts an object of the Driver class, it registers the specified Driver with the DriverManager.Driver myDriver = new com.mysql.jdbc.Driver(); DriverManager.registerDriver(myDriver);The forName() method loads the specified class into the memory and thus it automatically gets registered.Class.forName("com.mysql.jdbc.Driver");Step2: Get Connection: Get the ... Read More

Advertisements