错误404,路径没有错,代码也没错,火狐打不开,只输入localhost:8080可以显示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | <%@ page language= "java" contentType= "text/html; charset=utf-8" pageEncoding= "utf-8" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" > <html> <head> <title>人事管理系统</title> </head> <body> <% pageContext.setAttribute( "age" , 12 ); %> <br/> pagecontext作用域中获取的值: <%=pageContext.getAttribute( "age" ) %> <!-- 则可知pagecontext的作用域是jsp整个页面的器件 --> <%-- page的基本信息:<%= this .getServletInfo() %> // 获取输入行参数:<%=this.getInitParameter("") %> //获取我们最终修改的时间:<%=this.getLastModified("") %> // 获取servlet实例基本信息:<%=this.getServletInfo() this.getServletName() this.getServletConfig() this.getServletContext()%> --%> <br/> <% //request.setAttribute("name", "Imooc"); //第一个(key值)参数为String类型,第二个(value值)参数为Object类型 //request.getRequestDispatcher("result.jsp").forward(request, response); //当用户请求访问页面,直接转发给我们的另一个页面,getRequestDispatcher //这个方法的参数写请求转发的路径,调用forward方法,传递request和response对象 %> <h3 align= "center" >人事管理系统</h3> <hr> <!-- action代表了服务器端的处理程序 --> <form action= "control.jsp" > <table align= "center" > <tr> <td> 账号 </td> <td> <input type= "text" name= "account" /> </td> </tr> <tr> <td> 密码 </td> <td> <input type= "password" name= "password" /> </td> </tr> <tr> <td> <input type= "submit" value= "登录" /> </td> </tr></table> </form> </body> </html> |
20
收起
正在回答
2回答
你再检查一下,你的项目有没有配置Path;
双击Tomcat,选择Modules,检查一下你的Path有没有配置:
如上图,如果要访问项目根路径下的login.jsp,那么就应该是:
localhost:8080/Demo/login.jsp
祝学习愉快!
从网页搭建入门Java Web2018版
- 参与学习 人
- 提交作业 1088 份
- 解答问题 10204 个
如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧