首页>代码>基于MVC模式的Java web增删改查简单实例>/LOLHero/src/servlet/HeroAddServlet.java
package 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 bean.Hero;
import dao.HeroDAO;

/**
* @author 作者: guya
* description:
*/
public class HeroAddServlet extends HttpServlet {
	protected void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
		String name=request.getParameter("name");
		int hp=Integer.parseInt(request.getParameter("hp"));
		Hero hero=new Hero();
		hero.setName(name);
		hero.setHp(hp);
		new HeroDAO().add(hero);
		
		response.sendRedirect("listHero");
		
		
	}
}
最近下载更多
liuliuyl  LV3 2023年6月17日
小顾顾顾顾顾  LV4 2023年6月7日
ZDM133  LV2 2023年5月22日
人生三重奏  LV1 2022年12月21日
无名氏111  LV33 2022年12月16日
1379585889  LV11 2022年12月14日
bigstone1  LV1 2022年11月9日
微信网友_6208827097387008  LV1 2022年11月7日
sdkjfhg  LV1 2022年3月6日
guanxiaopeng  LV1 2021年12月21日
最近浏览更多
yongle  LV1 2024年12月31日
微信网友_7052938295398400  LV1 2024年6月25日
暂无贡献等级
仙女山的月亮  LV2 2024年5月22日
无敌最俊朗啊  LV2 2023年12月29日
asddwh  LV13 2023年12月25日
颜菜菜  LV2 2023年12月23日
CCCCWWWW  LV4 2023年12月11日
jkjfdgbkl  LV2 2023年11月1日
graceful 2023年10月18日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友