If you need to send a list to the JSP interface in the background
Write this in the Java file
list<user> albums = new arraylist<user> ();
..
Albums.add (user);
..
Request.setattribute ("albums", albums);
Traverse a linked list in a JSP file
<c:foreach items= "${albums}" var= "album" >
<tr>
<td>${album.albumname}</td>
<td>${album.disc}</td>
<td>${album.date}</td>
<td>${album.name}</td>
</tr>
</c:forEach>
However, the operation will cause an inexplicable error:
Org.apache.jasper.JasperException:javax.el.PropertyNotFoundException:Property ' albumname ' not readable on type Webalbum.user
Return to User.java view, the albumname variable is actually defined, but it will also produce this error ...
After a long exploration, we found that we had to define get in the User.java file ... function to use the corresponding variable in the JSP file
For the example above, you have to define four return functions:
public string Getalbumname ()
{
return albumname;
}
public string Getdisc ()
{
return disc;
}
public string getdate ()
{
return date;
}
public string GetName ()
{
return name;
}
At this point the JSP page can display the contents of the linked list normally. Problem solving
JSP programming problems encountered in the foreground transfer parameters