【狂神说JAVA】Docker P.30 web.xml文件和index.jsp文件
使用apache-tomcat-9.0.58
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaeehttp://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID"
version="3.1">
</web-app>
index.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>
Hello World!<br/>
<%
out.println("你的 IP 地址 " + request.getRemoteAddr());
%>
</body>
</html>
成功截图:

本文介绍了如何在Docker环境下使用Apache Tomcat 9.0.58部署web应用。通过配置web.xml文件和创建index.jsp页面,展示了基本的Web应用设置和JSP页面展示用户IP地址的功能。成功运行截图验证了配置的正确性。
5万+

被折叠的 条评论
为什么被折叠?



