SSM框架快速搭建(五)

14、编写前端页面

        先给出结构目录:

        在webapp下的index.jsp页面写入两个链接地址

        index.jsp内容:

<%@page contentType="text/html;charset=utf-8"%>
<html>
<body>
<h2>Hello World!</h2>
<a href="stu/findStu">学生信息</a>
<a href="classes/findClasses">班级信息</a>
</body>
</html>

14.1、在views下编写showClasses.jsp页面

<%--
  Created by IntelliJ IDEA.
  User: qrs-ljy
  Date: 2022/8/30
  Time: 18:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>班级信息</title>
</head>
<body>
<form action="addClasses" method="post">
    班级名称:<input type="text" name="className"><br>
    开班日期:<input type="text" name="createDate"><br>
    班级人数:<input type="text" name="stuCount"><br>
    <input type="submit" value="添加班级"><br>
</form>
${msg}
<hr>
<table border="1">
    <c:forEach items="claList" var="cla">
    <tr>
        <td>${cla.classId}</td>
        <td>${cla.className}</td>
        <td>${cla.createDate}</td>
        <td>${cla.stuCount}</td>
    </tr>
</table>
</body>
</html>

14.2、在views下编写showStu.jsp页面

<%--
  Created by IntelliJ IDEA.
  User: qrs-ljy
  Date: 2022/8/30
  Time: 17:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>学生信息</title>
</head>
<body>
<form action="addStu" method="post">
    姓名:<input type="text" name="stuName"><br>
    住址:<input type="text" name="stuAddress"><br>
    班级:<input type="text" name="fkClassId"><br>
    <input type="submit" value="添加学生"><br>
</form>
${msg}
<hr>
<table border="1">
    <c:forEach items="list" var="stu"/>
    <tr>
        <td>${stu.stuId}</td>
        <td>${stu.stuName}</td>
        <td>${stu.stuAddress}</td>
        <td>${stu.fkClassId}</td>
    </tr>
</table>
</body>
</html>

15、以上就完成了项目多有的代码,开始部署tomcat

 (提示3写错单词了,该是ssm war exploded,尴尬)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值