0

我是 jsp 的新手,我按照教程学习它,但是该教程中的给定示例在我的浏览器中不起作用,浏览器只显示我编写的代码而不是输出。

我希望在浏览器上看到当前时间,但我只看到显示的代码本身。

我正在使用火狐。

jsp代码

<HTML>
<BODY>
 Hello!  The time is now <%= new java.util.Date() %>
</BODY>
</HTML>
4

2 回答 2

1

安装 Apache Tomcat 或 Glassfish 服务器:

一旦你的服务器启动并运行到你的 index.jsp 的路径应该是这样的:

http://localhost:8080/index.jsp

这应该可以解决您的问题

于 2013-07-30T09:45:06.867 回答
0

You need to run your JSP in a servlet container in order that the Java code is executed, e.g. Apache Tomcat.

The servlet container runs the java code on server side and sends the response to the client.

Since you wrote you just started learning JSP and web technologies, this question might also be helpful. It contains also some information about Servlets, JSPs and web containers and how they work together.

于 2013-07-30T09:40:48.097 回答