记录一些比较常用的简单jsp模板
一:登录
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>登录页面</title>
</head>
<body>
<form name="frmlogin" method="post" action="${pageContext.request.contextPath}/doLogin">
用户名:<input name="username" type="text"/></br>
密 码:<input name="password" type="password"/></br>
<input name="resetbtn" type="reset" value="重置"/>
<input name="loginbtn" type="submit" value="登录"/>
</form>
</body>
</html>
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200708230841492.png)
二:显示信息
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>客户管理</title>
</head>
<body>
<form name="frmsearch" action="${pageContext.request.contextPath}/docust?op=search" method="post">
<input type="text" name="custname" value="${requestScope.condition.custname}">
<input class="btnsearch" type="submit" value="查询">
</form>
<table>
<tr>
<th>编号</th>
<th>客户名</th>
<th>联系人</th>
<th>电话</th>
<th>邮箱</th>
<th>操作</th>
</tr>
<c:forEach items="${requestScope.custs}" var="cust">
<tr>
<td>${cust.custid}</td>
<td>${cust.custname}</td>
<td>${cust.contacts}</td>
<td>${cust.tel}</td>
<td>${cust.email}</td>
<td>
<a href="${pageContext.request.contextPath}/docust?op=toedit&custid=${cust.custid}">修改</a>
|
<a href="${pageContext.request.contextPath}/docust?op=todel&custid=${cust.custid}">删除</a>
</td>
</tr>
</c:forEach>
</table>
</body>
</html>
![在这里插入图片描述](https://img-blog.csdnimg.cn/2020070823085485.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzMzkyNzU5,size_16,color_FFFFFF,t_70)
三:添加信息
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>添加客户</title>
</head>
<body>
<form name="frmadd" method="post" action="${pageContext.request.contextPath}/docust?op=doadd">
客户名称:<input name="custname" type="text"/></br>
联系人:<input name="contacts" type="text"/></br>
邮箱:<input name="email" type="email"/></br>
电话:<input name="tel" type="tel"/></br>
<input name="resetbtn" type="reset" value="重置"/>
<input name="addbtn" type="submit" value="添加"/>
</form>
</body>
</html>
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200708230906692.png)