你的image12的type是file,
所以我想这句String pictureName=request.getParameter("image12");
不能取到值 

解决方案 »

  1.   

    我进一步测试,还发现,连这句也取不到值:
    String name=request.getParameter("id");这是什么问题?
      

  2.   

    另外,这里我想应该用getAttribute方法,它返回的是一个Object,
    这样也就可以直接得到file对象你这样测试一下看行不:
    String pictureName=request.getAttribute("image12").getName();
                              //发现这句是取不到值的!
    //out.print(pictureName);这句用于测试,注释掉以下语句,用这句输出是null
    File picfile=new File(pictureName);//我经过测试,出现错误的是这里!我也没试过,你先试试吧
      

  3.   

    这样用了就会变成这样了:
    An error occurred at line: 8 in the jsp file: /5.jspGenerated servlet error:
        [javac] Compiling 1 source fileC:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test\org\apache\jsp\_5_jsp.java:61: cannot resolve symbol
    symbol  : method getName ()
    location: class java.lang.Object
    String pictureName=request.getAttribute("image12").getName();
                                           ^
    1 error
    我用resin和tomcat都试过,还是不行!真晕!!!
      

  4.   

    可是为什么连这句都不行的?
    String name=request.getParameter("id");是不是服务器有问题?
      

  5.   

    你测试一下下面的一个小程序,看能不能用:
    <html>
    <body><h1>Please tell me about yourself</h1><form action="SimpleFormHandler.jsp" method="POST">
      Name: 
      <input type="text" name="firstName">
      <input type="text" name="lastName"><br>
    Sex:
        <input type="radio" checked name="sex" value="male">Male
        <input type="radio" name="sex" value="female">Female
    <p>
    What Java primitive type best describes your personality:
    <select name="javaType">
        <option value="boolean">boolean</option>
        <option value="byte">byte</option>
        <option value="char" selected>char</option>
        <option value="double">double</option>
        <option value="float">float</option>
        <option value="int">int</option>
        <option value="long">long</option>
    </select>
    <br>
    <input type="submit">
    </form>
    </body>
    </html>
    SimpleFormHandler.jsp 文件为:
    <html>
    <body><%// Grab the variables from the form.
        String firstName = request.getParameter("firstName");
        String lastName = request.getParameter("lastName");
        String sex = request.getParameter("sex");
        String javaType = request.getParameter("javaType");
    %>
    <%-- Print out the variables. --%>
    <h1>Hello, <%=firstName%> <%=lastName%>!</h1>
    I see that you are <%=sex%>. You know, you remind me of a
    <%=javaType%> variable I once knew.</body>
    </html>
      

  6.   

    enctype="multipart/form-data"
    除去句就可以了,这句不是标明确规定form可以进行文件操作的吗?
    之前我没有用这句,会有个错误,说什么SQLsever自动分割数据!不能成功,现在我去掉它又行了!
    我现在又发现,原来我这种方法,只能在本机上解决问题,变为我这样做已经没什么意义了.
    有没有更好的上传到数据库的方法了?
    不用jspsmartupload!!!
      

  7.   

    My God!!!终于知道自己的水平了!回去好好学习!
      

  8.   

    一个上传的例子:
    http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=33247
      

  9.   

    去掉multipart/form-data 只能在本机实现上传!我也正碰到这个问题!比较烦
      

  10.   

    问题解决!!用了multipart/form-data 是没有办法用getParameter()来取得值的!解决办法是在url后面加参数
      

  11.   

    在URL后加参数,用什么来获得参数啊?用这个行不行?getParameter().能不能举个例子?
      

  12.   

    是啊!就是用getParameter()来获取参数
    例如aaa.jsp?custom=111&user=12
    在aaa.jsp就用getParameter()来获取参数
      

  13.   

    是啊!就是用getParameter()来获取参数
    例如aaa.jsp?custom=111&user=12
    在aaa.jsp就用getParameter()来获取参数