新闻类型模块的模型、视图、控制器相应代码的编写

main
15536166141 5 months ago
parent e21e921902
commit 4a118aefd4

@ -0,0 +1,15 @@
package com.ssm.controller;
import com.ssm.entity.NewTypeModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("newtype")
public class NewTypeController {
//对象方式接收新闻类型信息
@RequestMapping("add")
public String test(NewTypeModel newType) {
System.out.println("新闻类型信息" + newType.toString());
return "showNewType";
}
}

@ -0,0 +1,92 @@
package com.ssm.entity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
*
*/
public class NewTypeModel {
/**
*
*/
private Integer TYid;
/**
*
*/
private Integer parentTypeId;
/**
*
*/
private String typeName;
/**
*
*/
private Boolean isEnabled;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
// 无参构造方法
public NewTypeModel() {}
// getter和setter方法
public Integer getTYid() {
return TYid;
}
public void setTYid(Integer TYid) {
this.TYid = TYid;
}
public Integer getParentTypeId() {
return parentTypeId;
}
public void setParentTypeId(Integer parentTypeId) {
this.parentTypeId = parentTypeId;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public Boolean getIsEnabled() {
return isEnabled;
}
public void setIsEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "NewTypeModel{" +
"新闻类型编号=" + TYid +
", 父级分类ID=" + parentTypeId +
", 类型名称='" + typeName + '\'' +
", 是否启用=" + isEnabled +
", 创建时间=" + createTime +
'}';
}
}

@ -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,60 @@
<%--
Created by IntelliJ IDEA.
User: 吴彦祖
Date: 2025/3/26
Time: 16:31
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>添加新闻类型</title>
</head>
<body>
<form action="newtype/add" method="post">
<table>
<tr>
<td>新闻类型编号:</td>
<td width="20"></td>
<td><input type="text" name="TYid" placeholder="请输入预约编号" /></td>
</tr>
<tr>
<td>类型名称:</td>
<td width="20"></td>
<td><input type="text" name="typeName" placeholder="请输入新闻类型名称" /></td>
</tr>
<tr>
<td>父级分类:</td>
<td width="20"></td>
<td>
<select name="parentTypeId">
<option value="">--请选择上级分类--</option>
<option value="1">车位改动</option>
<option value="2">物业公告</option>
<option value="3">社会新闻</option>
</select>
</td>
</tr>
<tr>
<td>是否启用:</td>
<td width="20"></td>
<td>
<input type="checkbox" name="isEnabled" value="true" checked /> 启用
</td>
</tr>
<tr>
<td>创建时间:</td>
<td width="20"></td>
<td><input type="text" name="createTime" 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>
Loading…
Cancel
Save