编写JSP脚本
上一页 主页 下一页

eg: Get Time
JSP与Servlet

我们最开始由一个 Hello, World! 的页面开始:

假设我们使用的是刚才完成的resin服务器,那么我们的webroot应该是/usr/local/resin/doc。(注意:这个假设将一直存在,直至讲座末尾)

将下面这个文件放在webroot下:

hello.jsp

<html>
<body>

<%
   String strHelloWorld = "Hello World!" ;
%>


<h1><%= strHelloWorld %></h1>
</body>
</html>

用浏览器浏览http://ur-resin-host:8080/hello.jsp,页面上显示:

Hello, World!