- 博客(40)
- 收藏
- 关注
原创 Servlet学习04
Servlet学习request请求转发 protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); String username = req.getParameter("username"); String password
2020-10-27 15:08:47
64
原创 Servlet学习03
Servlet学习下载文件 protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //1.获取要下载文件的路径 String realPath = "D:\\Users\\86139\\IdeaProjects\\java-01-maven02\\response\\target\\classes\\1.jp
2020-10-27 02:35:10
57
原创 Servlet学习02
Servlet学习1.请求转发protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ServletContext context = this.getServletContext(); context.getRequestDispatcher("/gp").forward(req,resp); }
2020-10-27 01:49:56
82
原创 Servlet学习01
Servlet学习1.ServletContext1.web容器在启动时,会给所有的web程序创建一个对应的ServletContext对象,它代表了当前web的应用。(可以保存数据,进行不同页面的共享数据)ServletContext context = this.getServletContext(); String name = "xxx";//数据 context.setAttribute("username",name);//将一个数据保存到ServletC
2020-10-16 01:28:48
73
原创 Maven使用
idea中使用Tomcat和Maven1.创建一个简单的网页Maven项目(1)创建项目选择自己安装的目录和配置好的settings、maven仓库(2)在main文件夹下创建java和recourses目录(3)在pom.xml中添加maven依赖 <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</a
2020-10-14 01:01:41
69
原创 Tomcat、Maven下载和相关配置
Tomcat和Maven配置Tomcat配置1.**https://tomcat.apache.org/**下载tomcat文件2.配置Tomcat的环境变量(1)在系统变量中新建一个CATALINA_HOME,变量值为tomcat的实际地址,在这之前先要配置好java和jvm的环境变量。(2)在path中新建%CATALINA_HOME%。3.在cmd命令框中输入service.bat install,之后就可以启动Tomcat9w.exe,点击start。4.浏览器中输入local h
2020-10-14 00:14:03
191
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人