我使用jsp和servlet来上传3张图片,同时在数据库中存储图像已经互换

时间:2015-08-04 05:49:22

标签: jsp servlets

有html代码。我想按文件名获取图片。

      <table>
      <tbody>
      <tr>
      <td class="td-color">Upload Photo:</td>
      <td class="td-border">
      <input type="file" name="mphoto"/></td>
      <td class="td-color">Upload Applicant's signature:</td>
      <td class="td-border"><input type="file" name="msignature"/></td>
      <td class="td-color">Upload Account Opening Form:</td>
      <td class="td-border"><input type="file" name="accopenform"/></td>
      </tr>
      </tbody>
      </table>

        Enumeration em = mpt.getFileNames();
        while (em.hasMoreElements()) {
            mptoken = (String) em.nextElement();
            fobj = mpt.getFile(mptoken);
            if (fobj != null) {
                mimg = fobj.getName();
                out.println("hi.." + mimg);
            }

            mptoken1 = (String) em.nextElement();
            fobj1 = mpt.getFile(mptoken1);
            if (fobj1 != null) {
                msign = fobj1.getName();

            }
            mptoken2 = (String) em.nextElement();
            fobj2 = mpt.getFile(mptoken2);
            if (fobj2 != null) {
                maocf = fobj2.getName();

            }
            mptoken3=(String)em.nextElement();
             fobj3=mpt.getFile(mptoken3);
             if(fobj3!=null)
             {
             mpkyfrm=fobj3.getName();  

        }

这是我一直使用的servlet,我想通过img tago的名称从jsp获取图像获取特定图像。我该怎么做??

0 个答案:

没有答案