one by one 项目 part 6

Posted Blueburble

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了one by one 项目 part 6相关的知识,希望对你有一定的参考价值。

package Controllerservlet;

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

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

import bean.student;

public class FormCheck extends HttpServlet {

	/**
		 * Constructor of the object.
		 */
	public FormCheck() {
		super();
	}

	/**
		 * Destruction of the servlet. <br>
		 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
		 * The doGet method of the servlet. <br>
		 *
		 * This method is called when a form has its tag value method equals to get.
		 * 
		 * @param request the request send by the client to the server
		 * @param response the response send by the server to the client
		 * @throws ServletException if an error occurred
		 * @throws IOException if an error occurred
		 */
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		HttpSession session= request.getSession(); 
		ArrayList<student> list = (ArrayList<student>)session.getAttribute("list");
		System.out.println(1122222);
        for(int i=0;list!=null&&i<list.size();i++){
        	System.out.println(111);
			String jj = request.getParameter("blogmark"+i);
			if (!jj.equals("")){
				student s = list.get(i);
				String cc=s.getId();
				String zz=s.getName();
				String  sql="update studentinfo set blogmark="+jj+" where name = \'"+zz+"\'and id="+cc+"";
				System.out.println(sql);
				 studentservlet.DbUtil  run=new studentservlet.DbUtil();
				   int n=run.updateSQL(sql);
				   if(n>=1)
					   out.print("操作成功");
				   else
					   out.print("操作失败");
			      }
		}
			
			
		
	}

	/**
		 * The doPost method of the servlet. <br>
		 *
		 * This method is called when a form has its tag value method equals to post.
		 * 
		 * @param request the request send by the client to the server
		 * @param response the response send by the server to the client
		 * @throws ServletException if an error occurred
		 * @throws IOException if an error occurred
		 */
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		doGet(request, response);
	}

	/**
		 * Initialization of the servlet. <br>
		 *
		 * @throws ServletException if an error occurs
		 */
	public void init() throws ServletException {
		// Put your code here
	}

}

  

实现一组数据的插入

数据库截图

 

以上是关于one by one 项目 part 6的主要内容,如果未能解决你的问题,请参考以下文章

雅思6分口语-Speaking Part One-Bird

Expected one result (or null) to be returned by selectOne(), but found: 6

软工小学期实践PART ONE

One by one系列一步步学习Golang web框架Gin

One by one系列一步步学习webpack打包

Python快速建站系列-Part.One-组装开发环境