1. Read the records in the database list
The 2.Controller construction model is as follows:
@RequestMapping ("Display.do")
Public Modelandview display (HttpServletRequest request, Modelmap model) {
listModel.addattribute ("list", myList);
/* Here you can append attribute*/
return new Modelandview ("display.jsp");
}
3.display.jsp using inline Java to display records
Page Introduction Class
<%@ page import= "Java.util.List"%>
<%@ page import= "Java.util.HashMap"%>
Get list
<%
list%>
Displaying Data in table Form
<table style= "width:100%" >
<tr>
<td>value1</td>
<td>value2</td>
<td>value3</td>
</tr>
<%for (int i=0;i<list.size (); i++) {%>
<tr>
<td><%out.print (List.get (i). Get ("Key1")); %></button></td>
<td><%out.print (List.get (i). Get ("Key2")); %></td>
<td><%out.print (List.get (i). Get ("Key3")); %></td>
</tr>
<%}%>
</table>
SPRINGMVC notes: JSP page gets a list of background data records