首页 > 代码库 > 新增模块步骤
新增模块步骤
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前台界面
新增模块步骤
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。