The first JSP program

Source: Internet
Author: User

This article describes how to write a first JSP program

1. Configure the server

(1) Select the server view in Eclipse (PS: Many children's shoes say that the server cannot be found because of the version issue of Eclipse, download jee version of Eclipse) and single New Server Wizard hyperlink

(2) Open the Select Server Type list box in the Define a New server interface, expand the Apache node, and select the Tomcat v7.0 server node

(3) Click Next, click the Browse button and select the Tomcat server installation path that you have installed

(4) Click Finish to add a server project in the servers view to start or stop the server

2. Specify a Web browser

Window/preferences/.../web browsers specify a Web browser

3. Write JSP Program

Create a new dynamic Web Project named 1.01, all with the default options.

Create a new JSP file index.jsp under the WebContent node and modify the default code in the Index.jsp file to the following code:

<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="UTF-8"Import="java.util.Date" %><!DOCTYPE HTML><HTML><Head><MetaCharSet=utf-8 "><title>Development of the first JSP Web site</title></Head><Body>Hello, this is my first JSP program<BR>now the time is:<%=New Date(). toLocaleString ()%></Body></HTML>

Run, select "Run on Server"

The following error occurred:

Several ports (8080, 8009) required by Tomcat v7.0 Server at localhost is already in use. The server may already is running in another process, or a system process could be using the port. To start this server you'll need to stop the other process or change the port number (s).

At the command prompt, enter Netstat-aon | findstr 8080

Obtaining the port is occupied by a process with a PID of 2692

Input tasklist |findstr 2692:

Can get the current port is Tomcat7.exe occupied

Continue entering Taskkill-f-im Tomcat7.exe or Taskkill/pid 2692/f

End the process

Start Tomcat normal again in eclipse

The first JSP program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.