前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >基于注解的ssm crud的项目03

基于注解的ssm crud的项目03

作者头像
Dlimeng
发布2023-06-27 16:34:50
发布2023-06-27 16:34:50
1100
举报
文章被收录于专栏:开源心路开源心路

jsp界面:

register.jsp:

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

application.setAttribute("basePath",basePath);

%>

<html>

<head>

<base href="<%=basePath%>" />

<title>员工注册</title>

</head>

<body>

<a href="${basePath}emp/emps">查询所有</a>

<form action="${basePath}emp/emps" method="POST">

<table border="2" align="center">

<!-- <tr>

<th>编号</th>

<td><input type="text" name="id"></td>

</tr> -->

<tr>

<th>姓名</th>

<td><input type="text" name="name"></td>

</tr>

<tr>

<th>薪水</th>

<td><input type="text" name="sal"></td>

</tr>

<tr>

<th>性别</th>

<td>

<input type="radio" name="sex" value="男"/>男

<input type="radio" name="sex" value="女" checked/>女

</td>

</tr>

<tr>

<td colspan="2" align="center">

<input type="submit" value="注册"/>

</td>

</tr>

</table>

</form>

</body>

</html>

list.jsp:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

application.setAttribute("basePath",basePath);

%>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<base href="<%=basePath%>" />

<title>所有</title>

<script type="text/javascript" src="${basePath}js/jquery-1.11.1.min.js"></script>

<script type="text/javascript">

$(function(){

$(".delete").click(function(){

var href=$(this).attr("href");

$("form").attr("action",href).submit();

return false;

});

});

</script>

</head>

<body>

<form action="" method="post">

<input type="hidden" name="_method" value="DELETE">

</form>

<table style="padding: 0.5em 0.5em;">

<thead>

<tr>

<th>姓名</th>

<th>价格</th>

<th>年龄</th>

<th>日期</th>

<th>操作</th>

</tr>

</thead>

<tbody>

<c:forEach var="lall" items="${requestScope.listAll}" >

<tr>

<td>

${lall.name }

</td>

<td>

${ lall.sal }

</td>

<td>

${ lall.sex }

</td>

<td>

<fmt:formatDate value="${lall.date}" type="both"/>

</td>

<td>

<a href="${basePath}emp/emps/${lall.id}">编辑</a>

&nbsp;&nbsp;

<a href="${basePath}emp/emps/${lall.id}" class="delete">删除</a>

</td>

</tr>

</c:forEach>

</tbody>

</table>

</body>

</html>

updatelist.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

application.setAttribute("basePath",basePath);

%>

<!DOCTYPE html>

<html>

<head>

<base href="<%=basePath%>" />

<meta charset="UTF-8">

<title>编辑-》查看</title>

</head>

<body>

<form action="${basePath}emp/emps" name="form1" method="POST">

<input type="hidden" name="_method" value="PUT"/>

<table>

<tbody>

<tr>

<td>姓名:</td>

<td>

<input name="name" value="${emps.name}" type="text">

</td>

</tr>

<tr>

<td>价格:</td>

<td>

<input name="sal" value="${emps.sal}" type="text">

</td>

</tr>

<tr>

<td>年龄:</td>

<td>

<input name="sex" value="${emps.sex}" type="text">

</td>

</tr>

<tr>

<td colspan="2">

<input name="date" value="${emps.date}" type="hidden">

<input name="id" value="${emps.id}" type="hidden">

<input type="submit" value="保存">

</td>

</tr>

</tbody>

</table>

</form>

</body>

</html>

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016-10-03,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档