初始项目

main
bainan 4 months ago
parent 9513a815ed
commit 6eb5685873

@ -0,0 +1,13 @@
package com.ssm.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class FirstController {
@RequestMapping("hello")
public String hello() {
System.out.println("1111");
return "showFirst";
}
}

@ -0,0 +1,22 @@
package com.ssm.controller;
import com.ssm.entity.TingchequyuModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("tingchequyu")
public class TingchequyuController {
//对象方式接收数据ModelAndView对象响应数据
@RequestMapping("add")
public ModelAndView test(TingchequyuModel tingchequyu){
//创建ModelAndView对象的同时设置了view的信息
ModelAndView mv=new ModelAndView("showTingchequyu");
//将这个对象showTingchequyu保存到ModelAndView对象中
mv.addObject("tingchequyuInfo", tingchequyu);
return mv;
}
}

@ -0,0 +1,18 @@
package com.ssm.controller;
import com.ssm.entity.YuyueModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("yuyue")
public class YuyueController {
//对象方式接收车辆预约信息
@RequestMapping("add")
public String test(YuyueModel yuyue){
System.out.println("车辆预约信息:"+yuyue.toString());
return "showYuyue";
}
}

@ -0,0 +1,129 @@
package com.ssm.entity;
/**
*
*/
public class TingchequyuModel{
/**
*
*/
private Integer id;
/**
*
*/
private String tingchequyuName;
/**
*
*/
private Integer tingchequyuNumber;
/**
*
*/
private String tingchequyuContent;
/**
*
*/
private String insertTime;
/**
*
*/
private String createTime;
/**
*
*/
public Integer getId() {
return id;
}
/**
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
public String getTingchequyuName() {
return tingchequyuName;
}
/**
*
*/
public void setTingchequyuName(String tingchequyuName) {
this.tingchequyuName = tingchequyuName;
}
/**
*
*/
public Integer getTingchequyuNumber() {
return tingchequyuNumber;
}
/**
*
*/
public void setTingchequyuNumber(Integer tingchequyuNumber) {
this.tingchequyuNumber = tingchequyuNumber;
}
/**
*
*/
public String getTingchequyuContent() {
return tingchequyuContent;
}
/**
*
*/
public void setTingchequyuContent(String tingchequyuContent) {
this.tingchequyuContent = tingchequyuContent;
}
/**
*
*/
public String getInsertTime() {
return insertTime;
}
/**
*
*/
public void setInsertTime(String insertTime) {
this.insertTime = insertTime;
}
/**
*
*/
public String getCreateTime() {
return createTime;
}
/**
*
*/
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
}

@ -0,0 +1,229 @@
package com.ssm.entity;
/**
*
*/
public class YonghuModel{
/**
*
*/
private Integer id;
/**
*
*/
private String username;
/**
*
*/
private String password;
/**
*
*/
private String yonghuName;
/**
*
*/
private Integer sexTypes;
/**
*
*/
private String yonghuIdNumber;
/**
*
*/
private String yonghuPhone;
/**
*
*/
private String yonghuEmail;
/**
*
*/
private String yonghuBanjiZhuanye;
/**
*
*/
private String yonghuPhoto;
/**
*
*/
private String createTime;
/**
*
*/
public Integer getId() {
return id;
}
/**
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
public String getUsername() {
return username;
}
/**
*
*/
public void setUsername(String username) {
this.username = username;
}
/**
*
*/
public String getPassword() {
return password;
}
/**
*
*/
public void setPassword(String password) {
this.password = password;
}
/**
*
*/
public String getYonghuName() {
return yonghuName;
}
/**
*
*/
public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName;
}
/**
*
*/
public Integer getSexTypes() {
return sexTypes;
}
/**
*
*/
public void setSexTypes(Integer sexTypes) {
this.sexTypes = sexTypes;
}
/**
*
*/
public String getYonghuIdNumber() {
return yonghuIdNumber;
}
/**
*
*/
public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber;
}
/**
*
*/
public String getYonghuPhone() {
return yonghuPhone;
}
/**
*
*/
public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone;
}
/**
*
*/
public String getYonghuEmail() {
return yonghuEmail;
}
/**
*
*/
public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail;
}
/**
*
*/
public String getYonghuBanjiZhuanye() {
return yonghuBanjiZhuanye;
}
/**
*
*/
public void setYonghuBanjiZhuanye(String yonghuBanjiZhuanye) {
this.yonghuBanjiZhuanye = yonghuBanjiZhuanye;
}
/**
*
*/
public String getYonghuPhoto() {
return yonghuPhoto;
}
/**
*
*/
public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto;
}
/**
*
*/
public String getCreateTime() {
return createTime;
}
/**
*
*/
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
}

@ -0,0 +1,115 @@
package com.ssm.entity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
*
*/
public class YuyueModel {
/**
*
*/
private Integer id;
/**
*
*/
private YonghuModel yonghu;
/**
*
*/
private TingchequyuModel tingchequyu;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-mm-dd HH:mm:ss")
private Date insertTime;
/**
*
*/
private Date createTime;
/**
*
*/
public Integer getId() {
return id;
}
/**
*
*/
public void setId(Integer id) {
this.id = id;
}
public YonghuModel getYonghu() {
return yonghu;
}
public void setYonghu(YonghuModel yonghu) {
this.yonghu = yonghu;
}
public TingchequyuModel getTingchequyu() {
return tingchequyu;
}
public void setTingchequyu(TingchequyuModel tingchequyu) {
this.tingchequyu = tingchequyu;
}
/**
*
*/
public Date getInsertTime() {
return insertTime;
}
/**
*
*/
public void setInsertTime(Date insertTime) {
this.insertTime = insertTime;
}
/**
*
*/
public Date getCreateTime() {
return createTime;
}
/**
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "YuyueModel{" +
"id=" + id +
// 输出用户姓名
", yonghuName=" + yonghu.getYonghuName() +
// 输出停车区域名称
", tingchequyuName=" + tingchequyu.getTingchequyuName() +
", insertTime=" + insertTime +
'}';
}
}

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- 配置注解扫描器配置spring容器初始化对象时需要扫描的包 -->
<context:component-scan base-package="com.ssm.controller"></context:component-scan>
<!-- 配置视图解析器,ctrl+shift+t搜索类将return的字符串逻辑视图+前缀+后缀,转换成真正的物理视图 -->
<!-- 逻辑视图success,真正的视图:/WEB-INF/view/success.jsp -->
<!-- -->
<!-- 配置注解驱动 -->
<mvc:annotation-driven/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 前缀 -->
<property name="prefix" value="/WEB-INF/view/"></property>
<!-- 后缀 -->
<property name="suffix" value=".jsp"></property>
</bean>
<bean class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
</bean>
</beans>

Binary file not shown.

Binary file not shown.

@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>展示入门程序信息</title>
</head>
<body>
Success!
</body>
</html>

@ -0,0 +1,20 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>展示商品分类信息</title>
</head>
<body>
Success!
<br>
区域编号:${tingchequyuInfo.id}
<br>
区域名称:${tingchequyuInfo.tingchequyuName}
<br>
车位数量:${tingchequyuInfo.tingchequyuNumber}
<br>
详情:${tingchequyuInfo.tingchequyuContent}
</body>
</html>

@ -0,0 +1,15 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>展示Controller接收及响应数据</title>
</head>
<body>
Success!
<br>
车位预约信息已在控制台输出!
</body>
</body>
</html>

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>SpringMVCFirst</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>springDispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- 配置DispatcherServlet的初始化参数 -->
<init-param>
<param-name>contextConfigLocation</param-name>
<!-- 配置SpringMVC配置文件的位置和名称-->
<param-value>classpath:springmvc.xml</param-value>
</init-param>
<!-- 该servlet在第一次加载的时候就被创建而不是等请求时才创建 -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springDispatcherServlet</servlet-name>
<!-- 可以应答所有请求 -->
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--编码过滤器,解决中文乱码问题-->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

@ -0,0 +1,23 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加停车区域信息</title>
</head>
<body>
<form action="tingchequyu/add" method="post">
区域编号:<input type="text" name="id">
<br>
区域名称:<input type="text" name="tingchequyuName">
<br>
车位数量:<input type="text" name="tingchequyuNumber">
<br>
详情:<textarea name="tingchequyuContent" rows="5" cols="35"></textarea>
<br>
<input type="submit" value="添加">
</form>
</body>
</html>

@ -0,0 +1,42 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加车辆预约</title>
</head>
<body>
<form action="yuyue/add" method="post">
<table>
<tr>
<td>预约编号:</td>
<td width="20"></td>
<td><input type="text" name="id" placeholder="请输入预约编号" /></td>
</tr>
<tr>
<td>预约用户:</td>
<td width="20"></td>
<td><input type="text" name="yonghu.username" placeholder="请输入预约用户" /></td>
</tr>
<tr>
<td>预约区域:</td>
<td width="20"></td>
<td><input type="text" name="tingchequyu.tingchequyuName" placeholder="请输入预约区域" /></td>
</tr>
<tr>
<td>预约时间:</td>
<td width="20"></td>
<td><input type="text" name="insertTime" placeholder="请输入上架日期" /></td>
</tr>
<tr>
<td align="right"><input type="reset" value="重置"></td>
<td></td>
<td align="center">
<input type="submit" value="添加">
</td>
</tr>
</table>
</form>
</body>
</html>

@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>入门程序</title>
</head>
<body>
<a href="hello">hello world</a>
</body>
</html>
Loading…
Cancel
Save