Spring MVC框架下 從后台讀取數據庫並顯示在前台頁面【筆記自用 不推薦作為參考】


1.書寫jsp頁面  people.jsp

   1.設計顯示格式以及內容顯示

   2.設計顯示內容的范圍

2.書寫entity實體類 PeopleFormMap.java

   書寫傳入的參數主要包括 要引用的數據庫名 以及主鍵字段   h_event    id

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>

 

 

   

   


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM