标签:http https 自己 eth 端口被占用 html char ted vax
会跳转到页面
跳转到页面
package com.loginservlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class LoginServlet extends HttpServlet{ private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub req.setCharacterEncoding("UTF-8"); resp.setContentType("text/html;charset=utf-8"); //获取参数 String username = req.getParameter("un"); String password = req.getParameter("pw"); PrintWriter printWriter = resp.getWriter(); //输出 System.out.println(username+password); if(username.equals("lyk") && password.equals("2016")){ printWriter.write("用户名: "+username+"\t\n密码: "+password); printWriter.close(); } else { printWriter.write("用户名或密码错误!"); } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub doGet(req, resp); }
其余代码见云盘项目
默认的路径不行要改成如图
好像说的是tomcat已经运行了,好像只用打开任务管理器把占用的那个什么javaw.exe给关掉,但是我没有找到。
就只有自己重启了一次,然后运行起来了。
云盘链接:
链接:https://pan.baidu.com/s/13_E73srMJnC1hy8YtWIpVw
提取码:lw6c
标签:http https 自己 eth 端口被占用 html char ted vax
原文地址:https://www.cnblogs.com/June-6th/p/10623236.html