2013-01-18 63 views
0

我有一個用SpringMVC 應用和我使用春天標籤,但是我一直在尋找在應用中拍照與攝像頭,我發現JQuery webcam plugin的解決方案。Spring MVC和HTML 5

問題是這是使用元素/標籤和Spring Taglib沒有這個標籤的定義。我怎麼能過來呢?我需要使用標籤,如彈簧標籤,或者是否有彈簧標籤替代品。下的一個例子,說明我的代碼功能:

代碼

<script type="text/javascript"> 


    $(document).ready(function(){ 

     $("#canvas").hide(); 

     $("#camera").webcam({ 
       width: 320, 
       height: 240, 
       useMicrophone: false, 
       mode: "callback", 
       swffile: "resources/swf/jscam_canvas_only.swf", 
       quality:85, 

       onSave: saveCB, 
       onCapture: function() { 
        $("#camera").hide(); 
        webcam.save(); 
        $("#canvas").show(); 
       }, 

       debug: function (type, string) { 
        $("#status").html(type + ": " + string); 
       } 

     }); 


     $('#upload').click(function() { 
      webcam.capture(); 
      return false; 
     }); 


     window.addEventListener("load", function() { 

      var canvas = document.getElementById("canvas"); 

      if (canvas.getContext) { 
       ctx = document.getElementById("canvas").getContext("2d"); 
       ctx.clearRect(0, 0, 320, 240); 
       image = ctx.getImageData(0, 0, 320, 240); 
      } 

      }, false); 

}); 


    <label id="status"></label>        
         <div id="camera"></div> 

         <div><p><canvas id="canvas" height="240" width="320"></canvas></p></div> 
         <input id="upload" type="button" value="Take Photo"> 
         <input id="retake" type="button" value="Re-Take Photo"> 


          <ol> 
           <li> 
            <label>Select Gender</label> 
            <form:select path="genderId" id="genderId" title="Select Your Gender"> 
            <form:options items = "${gender.genderList}" itemValue="genderId" itemLabel="genderDesc" /> 
            </form:select> 
            <form:errors path="genderId" class="errors"/> 
           </li>    

           <li><form:label for="weight" path="weight">Enter Weight <i>(lbs)</i></form:label> 
            <form:input path="weight" id="weight" title="Enter Weight"/><form:errors path="weight" class="errors"/> 
           </li> 
+0

你想在春天想要哪個元素/標籤? – insomiac

+0

是標籤 – devdar

回答

1

如果春天標籤不符合你的需求,你可以嘗試寫Tagx廣告自定義標籤。這些標籤是用jsp(x)編寫的,而不是java,所以它們適用於渲染任意的html。

+0

你可以引導我創建一個自定義彈簧標籤的例子 – devdar

+1

文檔似乎缺乏這些,但有這樣的:http://docs.oracle.com/javaee/5/tutorial/ doc/bnalk.html 要看到他們的行動,看看春天ROO,只需創建一個helloworld項目,你可以看到他們的行動。 – Solubris