------------------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