在Eclipese中添加Tomcat

window
preferences
server
Runtime Environment

进行Add Tomcat服务器,记得在server窗口中也要添加一下

新建web项目

  1. new 新建Dynamic Web project
  2. 在webcontent下面创建index.jsp
  3. 在浏览器中输入http://localhost:8080/Mystudy/index.jsp 进行访问项目
    WEB-INF无法通过浏览器直接访问,只能通过请求转发来访问

修改Eclipse中Tomcat的地址

Eclipse开发web项目

在Eclipse中编辑html文件实时预览

右键单击html文件 选择open with web page editor

页面中form表单的action填写如下

Eclipse开发web项目

编码问题

设置requset编码
request.setCharacterEncoding("utf-8");
或者
String name = new String(request.getParameter("username").getBytes("ISO8859-1"),"utf-8");

设置response编码
response.setContentType("text/html;charset=utf-8");

JDBC连接Mysql数据库

相关文章:

  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-01-02
  • 2021-12-03
  • 2021-05-03
猜你喜欢
  • 2021-11-20
  • 2021-12-01
  • 2021-11-07
  • 2021-11-20
  • 2021-09-07
  • 2021-11-12
相关资源
相似解决方案