gpt4 book ai didi

java - 创建 JavaServer Page Web 应用程序

转载 作者:行者123 更新时间:2023-11-28 23:29:10 26 4
gpt4 key购买 nike

我正在使用 Ubuntu 虚拟机。我需要根据网络浏览器提交的数据创建一个 HTML 文件。

这是 index.html 的 HTML:

<html>
<body>
<h2>My First JSP Application</h2>
<form method="post" action="welcome.jsp">
Please enter your name: <input type="text" name="name"/>
<br/>
<input type="submit" value="OK"/>
</form>
</body>
</html>

我把这个文件放在用户>tomcat>webapps>welcomeJSP(我创建的一个文件)

我还将文件 welcome.JSP 放在这个 welcomeJSP 文件夹中。

这是 welcome.JSP 的代码:

<html>
<body>
<%
String name = request.getParameter("name");
%>
<h2>Welcome, <%=name%></h2>
</body>
</html>

然后我进入虚拟机上的 Web 浏览器并输入 http://localhost:8080/welcomeJSP

但是没有网页显示无法连接。

我的电脑是通过以太网连接的,所以应该可以连接。

对我有什么想法吗?

最佳答案

好吧,首先你应该创建一个网络应用程序项目,本教程应该帮助你: http://met.guc.edu.eg/OnlineTutorials/JSP%20-%20Servlets/A%20servlet%20example.aspx

关于java - 创建 JavaServer Page Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32899512/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com