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

📄 productedupdate.jsp

📁 基于JSP的简单网上书店设计与实现(各模块完整齐全)
💻 JSP
字号:
<%@ page contentType="text/html; charset=GB2312"%>
<%@ page import="java.sql.*,com.jspsmart.upload.*"%>
<%@ page import="java.sql.* ,java.util.Date,java.text.SimpleDateFormat"%>
<jsp:useBean id="file_Bean" class="MyFly.Bean.file_Bean" scope="request"/>
<jsp:useBean id="useclassBean" class="MyFly.Bean.useclassBean" scope="request"/>
<jsp:useBean id="characterclassBean" class="MyFly.Bean.characterclassBean" scope="request"/>
<jsp:useBean id="productinfoBean" class="MyFly.Bean.productinfoBean" scope="request"/>

<%!
   String fun(String str)
   {
      try
	  {
	      return new String(str.getBytes("ISO8859_1"));
	  }
	  catch(Exception e)
	  {
	     return "";
	  }
   }
%>

<%
  try{
   String str=request.getRealPath("/");
   str+="\\XKB\\product_image";
   SmartUpload mySmartUpload=new SmartUpload();
   mySmartUpload.initialize(pageContext);
 
  mySmartUpload.setTotalMaxFileSize(20000000);
  mySmartUpload.upload();
  
   String productID=mySmartUpload.getRequest().getParameter("productID");
   productinfoBean.setProductID(productID);
   productinfoBean.getNew(productID);
   
   String productName=mySmartUpload.getRequest().getParameter("productName");
   productinfoBean.setProductName(productName);
  
   String useclassID=mySmartUpload.getRequest().getParameter("useclassID");
   productinfoBean.setUseclassID(Integer.parseInt(useclassID));
   
   String characterID=mySmartUpload.getRequest().getParameter("characterID");
   productinfoBean.setCharacterID(Integer.parseInt(characterID));
   
   String marketPrice=mySmartUpload.getRequest().getParameter("marketPrice");
   productinfoBean.setMarketPrice(Float.parseFloat(marketPrice));
   
   String preferPrice=mySmartUpload.getRequest().getParameter("preferPrice");
   productinfoBean.setPreferPrice(Float.parseFloat(preferPrice));
   
   SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");//将显示"1999-10-1 21:03:10"的格式. 
   Date currentTime_1 = new Date(); 
   String appendTime = formatter.format(currentTime_1); 
   productinfoBean.setShangData(appendTime);
   
   String storage=mySmartUpload.getRequest().getParameter("storage");
   productinfoBean.setStorage(Integer.parseInt(storage));
   
   com.jspsmart.upload.File maxpic=mySmartUpload.getFiles().getFile(0);
   String max=maxpic.getFileName();
   if(max == null || max=="" || max.equals(""))
   {
         //????,?????????
   }
   else
   {
     String maxFile="max"+max;
     file_Bean.setPathName(str);
     String maxName=file_Bean.getFileName(maxFile);
	 maxpic.saveAs("/XKB/product_image/" + maxName);
	 productinfoBean.setMaxPicture(maxName);
   }

   com.jspsmart.upload.File minpic=mySmartUpload.getFiles().getFile(1);
   String min=minpic.getFileName();
   if(min == null || min=="" || min.equals(""))
   {
       //????,?????????
   }
   else
   {
      String minFile="min"+min;
      file_Bean.setPathName(str);
      String minName=file_Bean.getFileName(minFile);
      productinfoBean.setMinPicture(minName);
	  minpic.saveAs("/XKB/product_image/" + minName);
   }
   
   String introduce=mySmartUpload.getRequest().getParameter("content");
   productinfoBean.setIntroduce(introduce);
   
   String tuijian=mySmartUpload.getRequest().getParameter("tuijian");
   if(tuijian==null)
   {
      productinfoBean.setTuijian(0);
	}
	else
	{
	   productinfoBean.setTuijian(1);
	}
   if(productinfoBean.update()==0)
   {
       out.println("<Script language=JavaScript>alert('????');javascript:history.back();</Script>");
   }
   else
   { 
       response.sendRedirect("proView.jsp?proType=all&pageNum=1&proNum=1");
   }
  }
  catch(Exception e)
   {
     out.println("<Script language=JavaScript>alert('??????');javascript:history.back();</Script>");
   }
   %>
 </body>
</html>

⌨️ 快捷键说明

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