博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JSP | 基础 | 新建Hello world 的三种方式
阅读量:4591 次
发布时间:2019-06-09

本文共 1667 字,大约阅读时间需要 5 分钟。

第一种:

 直接写一个 test.jsp 文件到ROOT文件目录下,内容如下,访问 “http://localhost:8080/test.jsp”

<%--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements.  See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License.  You may obtain a copy of the License at    http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.--%><%@ page session="false" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %><%java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy");request.setAttribute("year", sdf.format(new java.util.Date()));request.setAttribute("tomcatUrl", "http://tomcat.apache.org/");request.setAttribute("tomcatDocUrl", "/docs/");request.setAttribute("tomcatExamplesUrl", "/examples/");%>    
Document <% out.print("hello world!"); %>

第二种:

 在webapps新建一个子目录“helloJsp”,在“helloJsp”的目录下新建一个“index.jsp”(内容跟上面“test.jsp”一样)和一个“WEB-INF”子目录,在“WEB-INF”下新建“web.xml”(复制../../ROOT文件里“WEB-INF”即可)文件,和两个空间目录,“classes” “lib”,

 

 

  访问网址“http://localhost:8080/helloJsp/”

 

第三种:

通过建立web project 来新建hello world

参考网址: https://blog.csdn.net/u014079773/article/details/51397850

完。

转载于:https://www.cnblogs.com/jj81/p/9627001.html

你可能感兴趣的文章
local unversioned, incoming add upon update问题
查看>>
linux基础nfs服务和计划任务crond服务
查看>>
bzoj3998[TJOI2015]弦论
查看>>
leetcode:Pascal's Triangle II【Python版】
查看>>
2019 HL SC day10
查看>>
[IE编程] 多页面基于IE内核浏览器的代码示例
查看>>
对不同型号开发板的认识及环境搭建
查看>>
web.xml配置详解之listener
查看>>
tarjan模板
查看>>
请让本题永远沉睡于此(东方化改题+给的标程)
查看>>
fenby C语言 p7
查看>>
当下大部分互联网创业公司为什么都愿意采用增量模型来做开发?
查看>>
第二第三周暑期集训总结
查看>>
C#屏幕截图
查看>>
JQuery模仿a标签的点击事件
查看>>
github hexo 搭建博客
查看>>
JS调用百度地图API获取地理位置
查看>>
MSSQL 2005/2008 日志压缩清理方法小结
查看>>
BZOJ 1103 [POI2007]大都市meg(树状数组+dfs序)
查看>>
BZOJ 4260 Codechef REBXOR(字典树)
查看>>