首页>代码>java servlet开发最简单的用户登录注册,很适合java新手学习web开发>/登录注册/ss/src/com/qm/shishang/servlet/AddUserServlet.java
package com.qm.shishang.servlet;

import java.io.IOException;

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

import com.qm.shishang.dao.UserDao;
import com.qm.shishang.view.User;
/**
 * 增加一个用户
 * @author quanmin
 *
 */
public class AddUserServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;


	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		request.setCharacterEncoding("UTF-8");
		String userName=request.getParameter("userName");
		String userPassword=request.getParameter("userPassword");
		String userEmail=request.getParameter("userEmail");
		String userNicheng=request.getParameter("userNicheng");
		//组装
		User user=new User(userName, userPassword, userEmail, userNicheng);
		//存值
		new UserDao().addOne(user);
		//跳转
		response.sendRedirect("jsp/login.jsp");
	}

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

		this.doGet(request, response);
	}

}
最近下载更多
jiemomo  LV12 2023年10月18日
慵懒的小橘猫  LV11 2022年12月24日
000666  LV10 2022年12月24日
liangge2115  LV27 2022年11月13日
chenhan413  LV10 2022年5月5日
沆辙1111  LV6 2022年4月17日
微信网友_5862759611551744  LV1 2022年3月9日
采暖11  LV11 2021年12月6日
wanglinddad  LV55 2021年11月28日
drunkery-cat  LV4 2021年10月12日
最近浏览更多
1516299986  LV9 4月16日
liyan54188  LV2 2024年6月25日
bw200488  LV6 2024年6月5日
Jim_joker  LV1 2024年4月25日
tartaglia  LV2 2024年4月16日
xuweiwowzy  LV5 2024年1月14日
asddwh  LV13 2023年12月25日
jiemomo  LV12 2023年10月18日
zdfxcv  LV1 2023年10月14日
joker1branch  LV5 2023年6月19日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友