首页>代码>java servlet+xml开发联系人增删改查项目>/htmlContacts/src/Servlet/AddContactsServlet.java
package Servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Dao.Contact;
import Dao.ContactOperatorImp;

public class AddContactsServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=utf-8");
		PrintWriter writer = response.getWriter();
		String html = "";
		html += "<!doctype html>";
		html += "<html>";
		html += "	<head>";
		html += "		<meta content='utf-8'>";
		html += "	</head>";
		html += "	<body>";
		html += "		<h3 align='center'>修改联系人</h3>";
		html += "		<form action='"+request.getContextPath()+"/requestAddContactsServlet' method='post'>";
		html += "		<table border='1'  soild='1' style='margin: 0 auto'>";
		html += "			<tr>";
		html += "				<td>姓名</td>";
		html += "				<td><input type='text' name='name' required/></td>";
		html += "			</tr>";
		html += "			<tr>";
		html += "				<td>性别</td>";
		html += "				<td>";
		html += "					<input type='radio' name='gender' checked value='男'/>男"; 
		html += "					<input type='radio' name='gender' value='女'/>女";
		html += "				</td>";
		html += "			</tr>";
		html += "			<tr>";
		html += "				<td>电话</td>";
		html += "				<td><input type='text' name='phone' pattern='1[3|4|5|8][0-9][0-9]{8}$' title='手机号码是11位数' required/></td>";
		html += "			</tr>";
		html += "			<tr>";
		html += "				<td>年龄</td>";
		html += "				<td><input type='number' name='age' min='0' max='150' style='width:95%' required/></td>";
		html += "			</tr>";
		html += "			<tr>";
		html += "				<td>邮箱</td>";
		html += "				<td><input type='email' name='email' required/></td>";
		html += "			</tr>";
		html += "			<tr>";
		html += "				<td>Qq</td>";
		html += "				<td><input type='text' name='qq' required/></td>";
		html += "			</tr>";
		html += "			<tr align='center'>";
		html += "				<td colspan='2'>";
		html += "				<input type='submit' value='提交' />";
		html += "				<input type='reset' value='重置'/>";
		html += "				</td>";
		html += "			</tr>";
		html += "		</table>";
		html += "	</form>";
		html += "</body>";
		html += "</html>";
		writer.write(html);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
		
	}

	public void init(ServletConfig config) throws ServletException{
		super.init(config);
	}

}
最近下载更多
晚风吹过你的脸颊  LV1 2023年6月13日
撒野请你吃狗粮  LV2 2021年6月22日
我家大宝贝  LV4 2021年6月10日
苦逼搬砖工  LV3 2021年6月2日
abc5566  LV2 2021年5月29日
408673614  LV2 2021年3月15日
kaola1231  LV4 2020年12月19日
h012345678  LV8 2020年12月15日
ffffffff123  LV4 2020年12月11日
zhaoxiaodao  LV8 2020年11月18日
最近浏览更多
tkggddm  LV3 1月27日
asddwh  LV12 2023年12月25日
微信网友_6783897029726208 2023年12月18日
暂无贡献等级
zdfxcv  LV1 2023年10月14日
2036495585  LV9 2023年9月18日
keumarches 2023年8月31日
暂无贡献等级
652654393  LV2 2023年7月3日
Dhhddhdh 2023年6月24日
暂无贡献等级
晚风吹过你的脸颊  LV1 2023年6月13日
baowanhong  LV2 2023年6月11日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友