Writing Your First Java Web Program by Hand

one step
1. Create a project directory in WebApps
2. Write index.jsp
3. Create the WEB-INF directory
4. Test run
 
Two actual combat
1. Create a directory myhome in D:\apache-tomcat-7.0.81\webapps
2. Create and write the index.jsp file in myhome
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>My first JSP page</title>
</head>
<body>
    <h1>Welcome to my personal homepage</h1>
    <hr>
</body>
</html>
3. Create and write web.xml in D:\apache-tomcat-7.0.81\webapps\myhome\WEB-INF
<?xml version="1.0" encoding="ISO-8859-1"?>
  xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee
  version="3.0"
  metadata-complete="true">    
</web-app>
4. Start Tomcat and test

 



 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326850188&siteId=291194637