diff --git a/grademanagement-SpringMVCProject/src/com/ssm/controller/NoticeController.java b/grademanagement-SpringMVCProject/src/com/ssm/controller/NoticeController.java index ed5a249..f4654e5 100644 --- a/grademanagement-SpringMVCProject/src/com/ssm/controller/NoticeController.java +++ b/grademanagement-SpringMVCProject/src/com/ssm/controller/NoticeController.java @@ -1,4 +1,16 @@ package com.ssm.controller; +import com.ssm.entity.Notice; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/notice") public class NoticeController { -} + + @RequestMapping("/add") + public String addNotice(Notice notice) { + System.out.println("公告信息:" + notice.toString()); + return "showNotice"; + } +} \ No newline at end of file diff --git a/grademanagement-SpringMVCProject/src/com/ssm/entity/Notice.java b/grademanagement-SpringMVCProject/src/com/ssm/entity/Notice.java index 7c30f7d..fb2788a 100644 --- a/grademanagement-SpringMVCProject/src/com/ssm/entity/Notice.java +++ b/grademanagement-SpringMVCProject/src/com/ssm/entity/Notice.java @@ -1,4 +1,35 @@ package com.ssm.entity; +import java.util.Date; + public class Notice { -} + private Integer nid; + private String title; + private String content; + private Date createTime; + private Integer status; // 0草稿 1发布 + + public Notice() {} + + public Integer getNid() { return nid; } + public void setNid(Integer nid) { this.nid = nid; } + public String getTitle() { return title; } + public void setTitle(String title) { this.title = title; } + public String getContent() { return content; } + public void setContent(String content) { this.content = content; } + public Date getCreateTime() { return createTime; } + public void setCreateTime(Date createTime) { this.createTime = createTime; } + public Integer getStatus() { return status; } + public void setStatus(Integer status) { this.status = status; } + + @Override + public String toString() { + return "Notice{" + + "nid=" + nid + + ", title='" + title + '\'' + + ", content='" + content + '\'' + + ", createTime=" + createTime + + ", status=" + status + + '}'; + } +} \ No newline at end of file diff --git a/grademanagement-SpringMVCProject/web/WEB-INF/view/showNotice.jsp b/grademanagement-SpringMVCProject/web/WEB-INF/view/showNotice.jsp index a58b51b..6dafe18 100644 --- a/grademanagement-SpringMVCProject/web/WEB-INF/view/showNotice.jsp +++ b/grademanagement-SpringMVCProject/web/WEB-INF/view/showNotice.jsp @@ -1,16 +1,9 @@ -<%-- - Created by IntelliJ IDEA. - User: cesar - Date: 2026/4/28 - Time: 10:07 - To change this template use File | Settings | File Templates. ---%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> - Title + 提交成功 - +

Success! 公告信息已在控制台输出!

- + \ No newline at end of file diff --git a/grademanagement-SpringMVCProject/web/addNotice.jsp b/grademanagement-SpringMVCProject/web/addNotice.jsp index 879e9d6..d656544 100644 --- a/grademanagement-SpringMVCProject/web/addNotice.jsp +++ b/grademanagement-SpringMVCProject/web/addNotice.jsp @@ -1,16 +1,41 @@ -<%-- - Created by IntelliJ IDEA. - User: cesar - Date: 2026/4/28 - Time: 10:05 - To change this template use File | Settings | File Templates. ---%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> - Title + 添加公告 - +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
公告编号:
公告标题:
公告内容:
创建时间:
状态: + +
+
- + \ No newline at end of file