2018年1月28日 星期日

關於 Spring 多筆上傳

HTML <form id="id" name="name" method="POST" enctype="multipart/form-data" > <input multiple="multiple" name="file" type="file" /> // </form> JAVA
import org.springframework.web.multipart.MultipartFile; 
import org.springframework.web.multipart.MultipartHttpServletRequest;

@RequestMapping(value = "/url/name", method = RequestMethod.POST)
public ModelAndView modthName(HttpServletRequest request, HttpServletResponse response,
@RequestParam String htmval) throws Exception {

MultipartHttpServletRequest reqfile = (MultipartHttpServletRequest) request;
List<MultipartFile> files = reqfile.getFiles("file");


}

2018年1月25日 星期四

關於 HTML EDIT Trumbowyg 的使用

官方網站
   HTML 元件 
   
        <script src="自訂位置/trumbowyg.min.js"></script> //主要的功能
        <script src="自訂位置/plugins/upload/trumbowyg.cleanpaste.min.js"></script> //乾淨的黏貼功能 
        <script src="自訂位置/plugins/upload/trumbowyg.pasteimage.min.js"></script> //貼上圖片功能 
        <script src="自訂位置/langs/zh_tw.min.js"></script> //在地化元件
        <body>
        <div id="htmEdit"></div>
   簡單的文件 自訂化

$('#htmEdit').trumbowyg(
   {
    lang : 'zh_tw', //設定繁體中文 需要另外引入 /TrumbowygHtmlEditorSrc/langs/zh_tw.min.js.....
    btns : [
      [ 'undo', 'redo' ], // 設定按鈕 
      [ 'formatting' ],
      [ 'strong', 'em', 'del' ],
      [ 'superscript', 'subscript' ],
      [ 'link' ],
      [ 'insertImage' ],
      [ 'justifyLeft', 'justifyCenter', 'justifyRight',
        'justifyFull' ],
      [ 'unorderedList', 'orderedList' ],
      [ 'horizontalRule' ], [ 'removeformat' ],
      [ 'fullscreen' ] ]
   //Focus on editor: tbwfocus 焦點  
   //Blur on editor: tbwblur 離開 焦點  
   }).on('tbwinit', function() { // 若是修改 內文 的update 使用 INIT EVENT
  //Keep 當前輸入的值 。  
  $('#htmEdit').trumbowyg('html', '${vo.content}'); //有資料 則顯示 
 });


2018年1月16日 星期二

關於 Jqery Ajax 參數 簡單說明

  

   $.ajax({
         url: "", //網址
         type: 'POST', // 預設為 get
         data: null, // 傳送檔案 
         async: false, //是否為同步
         cache: false, //是否可暫存
         dataType : "json", //回傳 檔案 型別
         contentType: false, // 設定使用原定的傳輸協定
         processData: false, // 傳送檔案是否為序列化資料
         success: function (data) { // 成功時
          alert(data.XXX);
          
         },
         error : function(jqXHR, textStatus, errorThrown) { //發生錯誤時
                alert("發生錯誤:" + errorThrown);
         },
          beforeSend:function(){ //送出前
        //alert('show londing');
  },
  complete:function(){//完成後 不管有無錯誤
       //alert('unshow londing');
  }

});