zoukankan      html  css  js  c++  java
  • 添加删除图片

    调用我们自己的添加图片的代码,但是在删除图片时出现问题。hibernate他是可以把所有的图片放在一个set里面他自己更新图片信息

    下面是页面遍历图片,需要用到图片的id:

    <div class="product_detail" style="90%;margin:0px auto;padding-top:10px;text-align:left;">
                    <ul>
                        <s:iterator value="aProofs" var="file" status="stFile">
                            
                            <li style="position:relative;50px;height:50px;">
                                <input type="hidden" name="oldFileId" value="${file.id }"/>
                                <a rel="example_group"  href="/<s:property value="#file.photoPath"/>">
                                    <img src="/<s:property value="#file.photoPath"/>" border="0" style="50px;height:50px; vertical-align:middle;"/>
                                </a>
                                <s:if test='afterSaleService.orderStateSequence==88'>
                                    <a class="o2odelete"></a>
                                </s:if>
                            </li>
                        </s:iterator>
                        
                    </ul>
                </div>

    这个就是页面效果的删除,但并没有删除数据库中的数据:

    $(".o2odelete").click(function(){
            $(this).parent("li").remove();
        })

    上传图片的input:

          <div class="imgs" style="display:block;">
                        <div id="preview1"></div>
                        <input type="file"  name="imageFile" onchange="preview(this,1)"  class="comment-pic-upd" style="border:none;"/>
                        <img src="/m/images/account/file.jpg"/>
                    </div>

    后台需要用到的参数

    private File[] imageFile = null;                                       /*多文件上传*/

    private String[] oldFileId = null;
    private Set<AfterSaleProof> aProofs=null;

          After  after = userAfterSaleFace.getAfter(orderno).get(0);
                    after.setCustomMoney(afterSaleService.getCustomMoney());
                    after.setReason(afterSaleService.getReason());
                    Set<AfterProof> newProof=new HashSet<AfterProof>();
                    if(oldFileId!=null&&oldFileId.length>0){
                        for(String oldId : oldFileId) {
                            AfterProof  oldProof = userAfterSaleFace.getAfterSaleProof(oldId);
                            newProof.add(oldProof);
                        }
                    }
                    if(imageFile!=null){
                        for (int i = 0; i < imageFile.length; i++) {
                            AfterProofaf = new AfterProof();
                            if(imageFile != null){
                                String path=this.saveAttach(imageFile[i], imageFileFileName[i], 1, "afterSaleService");
                                af.setPhotoPath(path);
                                af.setName(imageFileFileName[i]);
                                af.setSerialNum(i+1);
                            }
                            newProofs.add(af);
                        }
                    }
                    after.setAfterProofs(newProofs);        
                    userAfterSaleFace.addOrUpdateAfterSaleService(afterSaleServices, methodArg);

    最后更新一下实体。

  • 相关阅读:
    单例模式(Singleton)在SQLite操作中的应用
    android中自定義progress
    eclipse中高亮显示相同的变量
    android定时滚动
    Android GridView中设置了Button以后就不能响应OnItemClick()
    java中转换文件大小
    android 的代码仓库
    Eclipse中代码提示功能补全
    poj 3635 Full Tank? (优先队列 + bfs)
    hdu 4279 Number (规律题 2012 ACM/ICPC Asia Regional Tianjin Online )
  • 原文地址:https://www.cnblogs.com/xiaoxiaojuan/p/6491786.html
Copyright © 2011-2022 走看看