标题:求助,jsp上传商品信息就直接GG了
只看楼主
Lolitak
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-6-14
 问题点数:0 回复次数:1 
求助,jsp上传商品信息就直接GG了
<%@ page language="java" import="java.util.*,java.text.*" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'raddItem.jsp' starting page</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
<script type="text/javascript">   
    function setChange(obj){
         var value=obj.value;   
     location.href="admin/product/raddItem.jsp?stagename="+value;   
    }
    </script>

  </head>
  
  <body>
  <jsp:useBean id="mybean" class="shoppingmanage.Manage"></jsp:useBean>
    <%
    //获取当前日期
    SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String mynow= sdf.format(new java.util.Date());
    //获取客户端数据
   
    String cid=null;
    String csname=request.getParameter("csname");   
    csname= new String(csname.getBytes("iso-8859-1"),"UTF-8");
    String ptname=request.getParameter("ptname");   
    ptname= new String(ptname.getBytes("iso-8859-1"),"UTF-8");
    String pprice=request.getParameter("pprice");
   // String pimage=request.getParameter("pimage");
  String pimage=(String)session.getAttribute("imageUrl");
   // pimage=getServletContext().getRealPath("/")+"admin\\product\\productimage\\"+pimage;
   int pnum=Integer.parseInt(request.getParameter("pnum"));
    String pcontent=request.getParameter("pcontent");
    pcontent= new String(pcontent.getBytes("iso-8859-1"), "utf-8");
     
    //条件查询数据表   
    String sql="select * from ccategory where pname='"+session.getAttribute("pname")+"'and stagename='"+csname+"'";
    ResultSet rs=mybean.select(sql);
    if(rs.next()){
    cid=rs.getString("id");
    sql="insert into product values('"+csname+"','"+ptname+"','"+pprice+"','"+pimage+"','"+pcontent+"','','"+mynow+"',"+pnum+")";
    mybean.insert(sql);
    out.print("商品添加成功");
    session.setAttribute("imageUrl", null);
    out.print("<script> window.history.back()</script>");
   }
   else
    out.print("商品添加不成功");
   %>
  </body>
</html>
搜索更多相关主题的帖子: starting content PUBLIC import title 
2016-06-14 22:24
Lolitak
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-6-14
得分:0 
有没有大佬,抬我一手,今天一个下午在这块花式报错
2016-06-14 22:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-465964-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.258512 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved