正在回答
5回答
同学的访问路径是什么呢?
如果想要访问StuScore.jsp 那么访问路径应该是:
localhost:8080/JSP内置对象自由变成1/StuScore.jsp
如果同学不可以访问到的话,建议同学把项目名改为纯英文以后再试下~
另外建议在Chrome浏览器或者火狐浏览器试一下,不建议使用Eclipse自带的浏览器。
祝学习愉快!
冲哥_
2018-10-12 21:57:34
package com.imooc.bean; public class Student { private String stuId; private String stuName; private int stugrade; public Student(String stuId, String stuName, int stugrade) { super(); this.stuId = stuId; this.stuName = stuName; this.stugrade = stugrade; } public String getStuId() { return stuId; } public void setStuId(String stuId) { this.stuId = stuId; } public String getStuName() { return stuName; } public void setStuName(String stuName) { this.stuName = stuName; } public int getStugrade() { return stugrade; } public void setStugrade(int stugrade) { this.stugrade = stugrade; } @Override public String toString() { return "Student [stuId=" + stuId + ", stuName=" + stuName + ", stugrade=" + stugrade + "]"; } }
package com.imooc.db; import java.util.HashMap; import java.util.Map; import com.imooc.bean.Student; public class DbUtil{ // public static Map <String,Student>map = new HashMap<String,Student>(); // // static{ // map.put("1",new Student("1","a",80)); // map.put("2",new Student("2","b",81)); // map.put("3",new Student("3","c",83)); // map.put("4",new Student("3","d",86)); // // } }
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" import = "java.util.* , com.imooc.bean.* , com.imooc.db.*"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>学生成绩筛选</title> </head> <body> <% Map<String, Student> app = new HashMap<String, Student>(); app.put("11071010", new Student("11071010", "赵明", 78)); app.put("11071011", new Student("11071011", "李雷", 78)); app.put("11071012", new Student("11071012", "韩梅梅", 78)); app.put("11071013", new Student("11071013", "大熊", 78)); app.put("11071014", new Student("11071014", "李静香", 78)); app.put("11071015", new Student("11071015", "胖虎", 78)); %> <% int i = 1; for (String key : app.keySet()) { Student stu = app.get(key); %> <div> 第<%=i%>条:<%=stu.toString()%></div><br> <% i++; } %> </body> </html>
chrismorgen
2018-10-11 11:05:30
404错误就是路径错误,可以检查提交的路径,或者访问的路径是否正确,如果还有问题,建议你将相关的代码粘贴一下,方便老师具有针对性的为你解答,要将粘贴的代码粘贴到回答中哦,否则会失去代码格式,祝学习愉快~
从网页搭建入门Java Web2018版
- 参与学习 人
- 提交作业 1088 份
- 解答问题 10205 个
如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星