1. The error you may have encountered is "property ' id ' not found '" ' Java.lang.String "exception
It means that there is no ID this attribute in the string class, and the modified method is:
<c:foreach items= "Videos" var= "video" >
Modified into:
<c:foreach items= "${videos}" var= "video" >
But you need to be aware that its error is: java.lang.String contrast type Bean. Student, which corresponds to Src/bean. Student.java files. And I'm already in the JSP ${studentlist} This variable, so this method is not the wrong solution.
2. It is said that the Bean's property name is wrong, or there is no Get,set method, but my bean has the following method. Also refer to the error "Javax.el.PropertyNotFoundException:Property ' Pnum ' not found on type Com.manager.Paper", at this point the solution is:
private int pnum;
private int psize;
It is recommended that you replace the names of these two properties
private int pnum;
private int psize;
It is said to be a naming convention, while Stu. EmpNo is estimated to be in the wrong size, replaced by ${stu.empno}, because El is the getter method of reading the property, and generally follows the property first letter lowercase. But my name is ID, so this method is not workable.
3. If the above two methods you still complain, the following is my own summary of the method:
Servlet.service () for servlet [JSP] in context with path
Javax.el.PropertyNotFoundException:Property ' id ' not found on type bean. Student
What you need to do is:
(1). First ensure that the loop <c:foreach items= "${studentlist}" var= "Stu", and then the call is ${stu.id}, ${stu.name};
(2). Then the attribute name is best lowercase, of course, the first letter must be lowercase, such as empno;
(3). The Student class variable private Integer ID corresponding to the CREATE table student (stuid int,username varchar (20)) in the database; Private String name where the type needs to be consistent while the get and set methods are set:
(4). In DAO, database additions and deletions are consistent in type, and the number Stuid and name username in the corresponding database are:
Delete operation
public static int Delete (Integer id) throws Exception {
String sql = "DELETE from student Wherestuid =?";
return jdbcconnect.executeupdate (SQL, id);
}
Query operations
Student.setid (Rs.getint ("Stuid"));
Student.setname (rs.getstring ("username"));
(5). If the above database, Java class variable type is consistent, the use of the correct method is still the error, it may be the following error:
When I define the function public Integer GetID () {return ID;} You'll get an error.
The same SetID () method is also modified, while the SetID () and GetID () methods in the DAO also modify "D=>d". So I still suspect that the naming conventions used in El are in mischief. And I can use code validation to modify lowercase d to be successful. The first error servlet.service () for the servlet needs to look at the exception thrown behind it, that is, the second error.
Another guess: El expression reference errors in Jstl should use ${info.type.id} instead of ${info.id} (not validated)