char(15)类型的话,如果你的值不足15位,会自动以空格补足,
getFileName()得到的名称可能不是15位的吧,
问题会不会在这里哪?

解决方案 »

  1.   

    查查An error occurs : java.lang.NullPointerException 
    是在那一行出错的?
    应该可以看到到
      

  2.   

    最新的jspsmartupload已经弃用
    mySmartUpload.init(config);
    mySmartUpload.service(request,response);
    这两个方法了,改用:
    mySmartUpload.initialize(pageContext);另外,你上传文件选择的静态页面也没有写错啊?
      

  3.   

    我已经把mySmartUpload.getFiles().getFile(1).fileToField(rs,"pic");
    改成mySmartUpload.getFiles().getFile(0).fileToField(rs,"pic");
    还是抛出同样的错误!!
    怎么办??
      

  4.   

    <%@ page contentType="text/html;charset=gb2312" %>
    <%@ page language="java" import="com.jspsmart.upload.*"%>
    <jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
    <jsp:useBean id="inewBean" scope="page" class="hitachi.news.inewBean" />
    <HTML>
    <BODY BGCOLOR="white">
    <H1>jspSmartUpload : Sample 3</H1>
    <HR>
    <%// Variables
    int count=0;
    // Initialization
    mySmartUpload.initialize(pageContext);
    // Only allow txt or htm files
    //mySmartUpload.setAllowedFilesList("htm,html,txt,,");
    // DeniedFilesList can also be used :
    // mySmartUpload.setDeniedFilesList("exe,bat,jsp");
    // Deny physical path 
    // mySmartUpload.setDenyPhysicalPath(true);
    // Only allow files smaller than 50000 bytes 
    // mySmartUpload.setMaxFileSize(50000);
    // Deny upload if the total fila size is greater than 200000 bytes
    // mySmartUpload.setTotalMaxFileSize(200000); 
    // Upload
    mySmartUpload.upload();
    // Save the files with their original names in a virtual path of the web server
    try {
    count = mySmartUpload.save("/pic/upload/news", mySmartUpload.SAVE_VIRTUAL);
    String title=mySmartUpload.getRequest().getParameter("title");
    String content=mySmartUpload.getRequest().getParameter("content");
    String picture=mySmartUpload.getFiles().getFile(0).getFileName();inewBean.insert_news(title,content,picture);  
    } catch (Exception e){
    out.println("<b>Wrong selection : </b>" + e.toString()); 
    }
    // Display the number of files uploaded
    out.println(count + " file(s) uploaded."); %>
    </BODY>
    </HTML> 
      

  5.   

    http://expert.csdn.net/Expert/topic/876/876147.xml?temp=.4891474
      

  6.   

    ResultSet rs=stmt.executeQuery("SELECT * FROM b1 WHERE id=23");
    ——》ResultSet rs=stmt.executeQuery("SELECT * FROM b1 WHERE id=23 for update");
    试试! 不过不一定好用。
    抛出异常应该在:
    mySmartUpload.getFiles().getFile(0).fileToField(rs,"pic");
    位置。