In the function of the controller in SPRINGMVC, if you need to get the data from the *.jsp page, you can write it yourself in the function brackets, SPRINGMVC will automatically encapsulate the pass-through.
Spring-mvc.xml
Join in
1 <!--auto-scan-->2 <context:component-scan base-package= "Cn.itcast.springmvc.service, Cn.itcast.springmvc.web.controller "/>3 <!--note Driver-->4 <mvc:annotation-driven/>
Controller.java two forms are possible, but the second, the parameters in the JSP page are PersonList1
List @RequestMapping ("/listall") public string listall (Map<string,object> model) { list<person> personlist = ps.listall (); model.put ("Personlist", personlist); system.out.println (" Listall hello "); return "Person/jpersonlist"; } //list @RequestMapping ("/listallother") public String listallother (Model model) { list<person> personlist1 = ps.listall (); model.addattriBute (PersonList1); system.out.println (" listallother1 hello"); return "Person/jpersonlist"; }
In the JSP page
<%@ page language= "java" pageencoding= "UTF-8"%><%@ taglib uri= "http// Java.sun.com/jsp/jstl/core " prefix=" C "%>El expression notation: ${pagecontext.request.contextpath}JSP notation: <%=request.getcontextpath ()%>
Controller and JSP transfer value in SPRINGMVC