⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editpesticideservlet.java

📁 该系统具体分为2个部分:前台和后台。 1.前台主要用于用户进行浏览和搜索
💻 JAVA
字号:
package ynuServlet;


import java.io.IOException;

import javax.servlet.RequestDispatcher;
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 ynuBean.UpdatePesticideBean;

public class EditPesticideServlet extends HttpServlet 
{
		public void init()throws ServletException
	    {
	    	
	    }
	    
	    public void doGet(HttpServletRequest request, HttpServletResponse response)
	        throws ServletException, IOException
	    {
	    	sendsql(request,response);
	    }
	    
	    public void sendsql(HttpServletRequest request, HttpServletResponse response)
	    throws ServletException,IOException
	    {  	  
	    	HttpSession session = request.getSession();   	
	    	String toJsp = "/EditPesticide.jsp";
	        String PID = (String)session.getAttribute("PID");
	        /*String Pname = (String)session.getAttribute("PName");
	        String tox = (String)session.getAttribute("Tox");
	        String cha = (String)session.getAttribute("Cha");
	        int qty = Integer.parseInt((String)session.getAttribute("qty"));
	        float price = Float.parseFloat((String)session.getAttribute("Price"));
	        String detail = (String)session.getAttribute("detail");
	        */
	        String Pname = request.getParameter("pname");
	        String tox = request.getParameter("tox");
	        String cha = request.getParameter("cha");
	        int qty = Integer.parseInt(request.getParameter("qty"));
	        float price = Float.parseFloat(request.getParameter("price"));
	        String detail = request.getParameter("content");
	        
	        UpdatePesticideBean aBean = new UpdatePesticideBean();
	        String msg = aBean.EditPesticide(PID, Pname, tox, cha, price, qty,detail);
	        session.setAttribute("editmsg", msg);
	    	RequestDispatcher dispatcher = request.getRequestDispatcher(toJsp);	
	    	//dispatcher = request.getRequestDispatcher(toJsp);   	
	    	response.setHeader("Refresh", "0.1; URL=/PesticideInfoManagement"+toJsp+"");
	    	dispatcher.forward(request, response);
	    }
		
	    
	    //Process the HTTP Post request
	    public void doPost(HttpServletRequest request, HttpServletResponse response)
	        throws ServletException, IOException
	    {
	        doGet(request, response);
	    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -