前提条件是配置好tomcat:在tomcat的项目目录下新建一个hello文件夹
1、hello.jsp
<html>
<head>
<title>HELLO JSP</title>
<body>
<%
out.print("Hello World!");
out.print("<h1>Hello World!</h1>");
out.print("<script type='text/javascript'>alert('Hello World!');</script>");
%>
</body>
</head>
</html>
2、input.html
<meta charset="utf-8">
<form action="input.jsp" method="post">
請輸入信息:<input type="text" name="msg" id="msg"/>
<input type="submit" value="發送">
</form>
3、input.jsp
<%
String str = request.getParameter("msg");
out.println("<h1>"+str+"</h1>");
%>
效果如下: