Eclipse开发web项目
Eclipse开发web项目
在Eclipese中添加Tomcat
进行Add Tomcat服务器,记得在server窗口中也要添加一下
新建web项目
- new 新建Dynamic Web project
- 在webcontent下面创建index.jsp
- 在浏览器中输入http://localhost:8080/Mystudy/index.jsp 进行访问项目
WEB-INF无法通过浏览器直接访问,只能通过请求转发来访问
修改Eclipse中Tomcat的地址
在Eclipse中编辑html文件实时预览
右键单击html文件 选择open with web page editor
页面中form表单的action填写如下
编码问题
设置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");