devdar
devdar

Reputation: 5654

Spring MVC and HTML 5

I have a SpringMVC application and i am using Spring Tags, however i was looking for a solution for taking pictures with a webcam in the application and i found JQuery webcam plugin.

The problem is this uses an element/tag and Spring Taglib does not have a definition for this tag. How can i over come this? I need to use the tag like a spring tag, or is there a spring tag alternative. Under is an example of how my code functions:

Code

<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> 

Upvotes: 0

Views: 1353

Answers (1)

Solubris
Solubris

Reputation: 3753

If spring tags dont meet your needs, you could try writing tagx custom tags. These tags are written in jsp(x), not java, so they are good for rendering arbitrary html.

Upvotes: 1

Related Questions