Output Hello World with JSP

Source: Internet
Author: User
Tags apache tomcat

------------------siwuxie095

In Eclipse's package Explorer, right-->new->other->web->dynamic Web Project

Tomcat uses the default installed Apache Tomcat v9.0

For the configuration of the Tomcat installation and environment variables, see my blog's classification: environment variable configuration ,

inside the Java tomcat Download, install, and configure environment variables

I blog (optional) Link:

https://www.baidu.com/s?ie=UTF-8&wd=siwuxie095

The engineering structure directory is as follows:

that Project Name: myjsp, click to select webcontent, right-click->new->jsp File, named hello.jsp

At this point, the engineering structure Catalog at a glance:

Add code inside the body of the hello.jsp

(1) JSP program segment:

use the <%%> package, where you can add any Java code

Note: variables defined in JSP program segments are local variables, between different requests

Have a separate definition of variables

Out is a built-in object for JSP that is used to output data in various formats to the client.

(2) JSP declaration:

using <%! %> packages, variables, functions, and classes for defining page ranges

Note: The variables defined in the JSP declaration are global variables, between different requests

Share a variable definition

The definition is complete and can be These definitions are used elsewhere in the JSP page

(3) JSP expression:

JSP expression is an expression that conforms to the Java syntax using the <%=%> package

expression does not end with a semicolon

the value of the expression can be directly output as a string, equivalent to <% out.print ()%>

will be Servers Open

Click Tomcat, right-->add and Remove, deploying myjsp to the Tomcat server

Start Tomcat, view the boot log in console (console) for exceptions

Open the browser and type in the Address bar (two options):

(1) localhost:8080/myjsp/hello.jsp

(2) 127.0.0.1:8080/myjsp/hello.jsp

"Made by siwuxie095"

Output Hello World with JSP

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.