zoukankan      html  css  js  c++  java
  • 新增模块步骤

    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前台界面

  • 相关阅读:
    QT获取句柄
    java多线程关键字volatile、lock、synchronized
    Java几种常见的设计模式
    将博客搬至CSDN
    0228-0308的笔记
    深入理解es6-Promise对象
    彻底理解正则
    es6学习笔记-class之继承
    es6学习笔记-class之一概念
    arguments对象详解
  • 原文地址:https://www.cnblogs.com/wujixing/p/5865605.html
Copyright © 2011-2022 走看看