JSP简明教程_MySQL
一、 什么是JSP
JSP(JavaServer Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准,其网址为http://www.javasoft.com/products/jsp。在传统的网页HTML文件(*.htm,*.html)中加入Java程序片段(Scriptlet)和JSP标记(tag),就构成了JSP网页(*.jsp)。Web服务器在遇到访问JSP网页的请求时,首先执行其中的程序片段,然后将执行结果以HTML格式返回给客户。程序片段可以操作数据库、重新定向网页以及发送 email 等等,这就是建立动态网站所需要的功能。所有程序操作都在服务器端执行,网络上传送给客户端的仅是得到的结果,对客户浏览器的要求最低,可以实现无Plugin,无ActiveX,无Java Applet,甚至无Frame。
本文将介绍利用JSP技术开发动态网页的方法,还将简要分析JSP技术和 Microsoft 公司的 ASP 技术的不同之处。
二、 如何安装和启动
为了实验JSP技术,首先需要建立运行环境,这个过程相当简单:
1、在 http://java.sun.com/jdk/处下载JDK(Java 2 SDK、Standard Edition、v 1.2.2)。
2、在http://java.sun.com/products/jsp/处下载JSWDK(JavaServer Web Development Kit 1.0.1)。Linux用户可以在http://jakarta.apache.org/处下载Tomcat 3.0。
3、安装
以Windows NT环境为例,JDK的安装是首先运行下载得到的jdk1_2_2-win.exe,然后修改系统环境参数,在PATH参数中加入[x:]jdk1.2.2in以及增加新的环境参数 CLASSPATH=[x:]jdk1.2.2lib ools.jar,其中[x:]是安装JDK的硬盘符(c:、d: 等)。 JSWDK的安装仅需将jswdk1_0_1-win.zip带目录释放到硬盘根目录下(c:、d: 等),然后就可以在硬盘上找到jswdk-1.0.1目录。将来如果不想保留JSWDK,删除这个目录就可以了,没有任何系统文件和注册表遗留问题。更详细的安装过程以及Solaris/Unix和Linux下JDK、Tomcat的安装可以参考下载得到的文件包中的安装说明。
4、启动
以Windows NT环境为例,在jswdk-1.0.1目录下执行startserver.bat,就可启动JSWDK中一个支持JSP网页技术的Web服务器。为了不与现有的Web服务器(例如IIS、PWS等)冲突,JSWDK的Web服务器使用了8080端口。在浏览器的地址栏中键入http://localhost:8080或者http://127.0.0.1:8080后,如果能看到 JSWDK 的欢迎页就说明JSP实验环境已经建成,可进入下一步实验。要关闭Web服务器则运行stopserver.bat。
三、 JSP简单示例
JSWDK中包含的Web服务器的文档目录在缺省状态下为jswdk-1.0.1webpages,主文档在缺省状态下为index.html和index.jsp。也就是说访问http://localhost:8080等于访问jswdk-1.0.1webpagesindex.html。
用文本编辑器,如Windows中的记事本(Notepad),创建一个文本文件hi.jsp,保存在jswdk-1.0.1webpages目录下,其内容如下:
String Msg = "This JSP test.";
out.print("Hello World!");
%>
在浏览器的地址栏中键入http://localhost:8080/hi.jsp,JSWDK中的Web服务器会执行JSP 文件中用〈%以及%>括起来的Java程序语句,其中out.print是将文字输出到网页,语句〈%= 变量 | 表达式%>的作用是将Java Scriptlet中变量或表达式的值输出到网页.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

1. First open WeChat. 2. Click [+] in the upper right corner. 3. Click the QR code to collect payment. 4. Click the three small dots in the upper right corner. 5. Click to close the voice reminder for payment arrival.

After rain in summer, you can often see a beautiful and magical special weather scene - rainbow. This is also a rare scene that can be encountered in photography, and it is very photogenic. There are several conditions for a rainbow to appear: first, there are enough water droplets in the air, and second, the sun shines at a low angle. Therefore, it is easiest to see a rainbow in the afternoon after the rain has cleared up. However, the formation of a rainbow is greatly affected by weather, light and other conditions, so it generally only lasts for a short period of time, and the best viewing and shooting time is even shorter. So when you encounter a rainbow, how can you properly record it and photograph it with quality? 1. Look for rainbows. In addition to the conditions mentioned above, rainbows usually appear in the direction of sunlight, that is, if the sun shines from west to east, rainbows are more likely to appear in the east.

Detailed steps to install Go language on Win7 computer Go (also known as Golang) is an open source programming language developed by Google. It is simple, efficient and has excellent concurrency performance. It is suitable for the development of cloud services, network applications and back-end systems. . Installing the Go language on a Win7 computer allows you to quickly get started with the language and start writing Go programs. The following will introduce in detail the steps to install the Go language on a Win7 computer, and attach specific code examples. Step 1: Download the Go language installation package and visit the Go official website

Installing Go language under Win7 system is a relatively simple operation. Just follow the following steps to successfully install it. The following will introduce in detail how to install Go language under Win7 system. Step 1: Download the Go language installation package. First, open the Go language official website (https://golang.org/) and enter the download page. On the download page, select the installation package version compatible with Win7 system to download. Click the Download button and wait for the installation package to download. Step 2: Install Go language

PHP Tutorial: How to Convert Int Type to String In PHP, converting integer data to string is a common operation. This tutorial will introduce how to use PHP's built-in functions to convert the int type to a string, while providing specific code examples. Use cast: In PHP, you can use cast to convert integer data into a string. This method is very simple. You only need to add (string) before the integer data to convert it into a string. Below is a simple sample code

How to install PHPFFmpeg extension on server? Installing the PHPFFmpeg extension on the server can help us process audio and video files in PHP projects and implement functions such as encoding, decoding, editing, and processing of audio and video files. This article will introduce how to install the PHPFFmpeg extension on the server, as well as specific code examples. First, we need to ensure that PHP and FFmpeg are installed on the server. If FFmpeg is not installed, you can follow the steps below to install FFmpe

Essential PHP programs: Install these to run smoothly! PHP is a popular server-side scripting language that is widely used to develop web applications. To successfully run a PHP program, you first need to install some necessary software and tools on the server. In this article, we will introduce the software and tools that must be installed, along with specific code examples to help you run PHP programs smoothly. 1. PHP interpreter The core of the PHP program is the PHP interpreter, which is responsible for parsing and executing PHP code. To install the PHP interpreter, you can follow

Hongmeng OS is an operating system independently developed by Huawei and is dedicated to providing support for various smart devices. The Go language is a concise, fast, and concurrent programming language that has become increasingly popular in the field of software development in recent years. This article will teach you how to use Go language on Hongmeng system, and provide specific installation steps and code examples. Step 1: Preparation Before starting, make sure your Hongmeng system has been correctly installed and the development environment has been configured. At the same time, you need to install the Go language development environment on your computer, which can be done through [official
