我无法访问listservice.jsp页面并打印数据。下面是我的控制器。如果这是个愚蠢的问题,请不要介意。我刚开始学春靴
@Controller
@RequestMapping(value = "/rest/users")
public class ServicesResource {
@Autowired
ServicesRepository servicesRepository;
@RequestMapping(value = "/all")
public ModelAndView getAll(ModelAndView view) {
view.addObject("list", (List<Services>) servicesRepository.findAll());
view.setViewName("ListService");
return view;
}
}
以及appilation.properties文件。
spring.datasource.url=jdbc:mysql://192.168.40.28:3306/ksrtc_oprsdb
spring.datasource.username=ksrtcdba
spring.datasource.password=ksrtcdba1234
spring.jpa.show-sql=true
spring.hibernate.properties.hibernate.dialect=org.hibernate.dialect.MySQL55Dialect
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
server.port=3001
spring.mvc.view.prefix=/WEB-INF/Jsp/
spring.mvc.view.suffix=.jsp
下面是我的jsp文件listservices.jsp
<% Map x = (Map)request.getAttribute("list") %>
暂无答案!
目前还没有任何答案,快来回答吧!