|
JSP
Introduction JavaServer Pages™ (JSP) is a web-scripting technology similar to Netscape server-side JavaScript (SSJS) or Microsoft Active Server Pages (ASP). However, it's more easily extensible than SSJS or ASP, and it isn't proprietary to any one vendor or any particular web server. Although the JSP specification has been managed by Sun Microsystems, any vendors can implement JSP in their own systems. A Simple Example A JSP page looks like a standard HTML or XML page, with additional elements that the JSP engine processes and strips out. Typically, the JSP elements create text that is inserted into the results page. The following JSP page is very simple; it prints the day of the month and the year, and welcomes you with either "Good Morning" or "Good Afternoon," depending on the time of day. The page combines ordinary HTML with a number of JSP elements:
<HTML> <H1>Welcome</H1> <P>Today is </P>
<% if (Calendar.getInstance().get(Calendar.AM_PM)
==== Calendar.AM) { %> </HTML> JSP Request Model Now let's take a look at how HTTP requests are processed under the JSP model. In the basic request model, a request is sent directly to a JSP page. Figure 1 illustrates the flow of information in this model. JSP code controls interactions with JavaBeans components for business and data logic processing, and then displays the results in dynamically generated HTML mixed with static HTML code.
The beans depicted can be JavaBeans or EJB components. Other, more complicated request models include calling out to other JSP pages or Java servlets from the requested JSP page. JDBC API The JDBC API is a Java API for accessing virtually any kind of tabular data. (As a point of interest, JDBC is the trademarked name and is not an acronym; nevertheless, JDBC is often thought of as standing for "Java Database Connectivity.") The JDBC API consists of a set of classes and interfaces written in the Java programming language that provide a standard API for tool/database developers and makes it possible to write industrial strength database applications using an all-Java API. The JDBC API makes it easy to send SQL statements to relational database systems and supports all dialects of SQL. But the JDBC 2.0 API goes beyond SQL, also making it possible to interact with other kinds of data sources, such as files containing tabular data. The value of the JDBC API is that an application can access virtually any data source and run on any platform with a Java Virtual Machine. In other words, with the JDBC API, it isn't necessary to write one program to access a Sybase database, another program to access an Oracle database, another program to access an IBM DB2 database, and so on. One can write a single program using the JDBC API, and the program will be able to send SQL or other statements to the appropriate data source. And, with an application written in the Java programming language, one doesn't have to worry about writing different applications to run on different platforms. The combination of the Java platform and the JDBC API lets a programmer write once and run anywhere. n simplest terms, a JDBC technology-based driver ("JDBC driver") makes it possible to do three things:
JSP Database Example This is a simple test program for JDBC API interface. This java application will connect to a JDBC driver, issue a select statement and display all result columns and rows. Links
|
||
|
Created by Jian-Qing
Wu
Last modified: |
||