1. 数据库里更新链接: Business Trip url:/trip/getBizList
2. controller雏形
package com.web.controller; import java.io.IOException; import java.io.PrintWriter; import java.net.URLDecoder; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.web.controller.entity.Education; import com.web.controller.service.EduService; @Controller @RequestMapping("/trip") public class tripController { @Resource private EduService eduService; @RequestMapping("/getBizList") public String getBizList(HttpServletRequest request,HttpServletResponse response){ return "/tripController/tripManager"; } }
3. 建实体类:
4. 新建数据库表hbm.xml
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.web.controller.entity"> <class name="Trip" table="tsdr_trip"> <id name="id"> <generator class="native"></generator> </id> <property name="name" /> <property name="part" /> <property name="subPart" /> <property name="Purpose" /> <property name="scheduleStart" /> <property name="scheduleEnd" /> <property name="duration" /> <property name="destination" /> <property name="region" /> </class> </hibernate-mapping>
5. 在hibernate.cfg.xml里新增 <mapping resource ="com/web/controller/entity/Trip.hbm.xml" />
6 ,新增service接口和实现类
重启工程, 看数据表是否生成
7 。开始写 jsp前台界面
时间: 2024-10-12 19:22:01