您的位置:首页 > 编程语言 > Java开发

Spring MVC框架下 从后台读取数据库并显示在前台页面【笔记自用】

2017-10-02 14:17 585 查看

1. 书写jsp页面 people.jsp

1. 设计显示格式以及内容显示
2. 设计显示内容的范围


2.书写entity实体类 PeopleFormMap.java

书写传入的参数主要包括:要引用的数据库名,以及主键字段h_eventid


3.书写service层

PeopleService  继承底层的 BaseService


4.书写service实现类 PeopleServiceImpl

@peopleservice


5.书写controller层 PeopleController Controller实现 界面和service实现类的数据交互

@RequestMapping(“/people”)

public class PeopleController extends BaseController{

private PeopleService peopleservice;

@ResponseBody

@RequestMapping("peoplelist")

public String peoplelist(String txtSelect ) throws Exception{

return "success";}

}


6.书写js页面

function initPeopleList(){

var url= rootPath + '/people/findByPage.shtml';

书写想要显示字段内容

封装data{

}

}


7.mapping

书写sql查询语句
<mapper namespace="RiskForcastMapper">
<select id="" resultType="java.util.HashMap">
select * from .....
</select>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐