Search code examples
javaspringjsp

Missing end tag for "form:input"


I have error in first line of following jsp page

<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
    <%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
    <html>
    <head>
    <meta http-equiv="Content-Type"
        content="text/html; charset=ISO-8859-
    1">
    <link rel="stylesheet"
        href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/boo
    tstrap.min.css">
    <title>Products</title>
    </head>
    <body>
        <section>
            <div class="jumbotron">
                <div class="container">
                    <h1>Products</h1>
                    <p>Add products</p>
                </div>
            </div>
        </section>
        <section class="container">
            <form:form modelAttribute="newProduct" class="form-horizontal">
                <fieldset>
                    <legend>Add new product</legend>
                    <div class="form-group">
                        <label class="control-label col-lg-2 col-lg-2" for="productId">Product
                            Id</label>
                        <div class="col-lg-10">
                            <form:input id="productId" path="productId" type="text"
                                class="form:input-large" />
                        </div>
                    </div>
                    <!-- Similarly bind <form:input> tag for
    name,unitPrice,manufacturer,category,unitsInStock and unitsInOrder
    fields-->
                    <div class="form-group">
                        <label class="control-label col-lg-2" for="description">Description</label>
                        <div class="col-lg-10">form:textarea id="description"
                            path="description" rows = "2"/></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-lg-2" for="discontinued">Discontinued</label>
                        <div class="col-lg-10">
                            <form:checkbox id="discontinued" path="discontinued" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-lg-2" for="condition">Condition</label>
                        <div class="col-lg-10">
                            <form:radiobutton path="condition" value="New" />
                            New
                            <form:radiobutton path="condition" value="Old" />
                            Old
                            <form:radiobutton path="condition" value="Refurbished" />
                            Refurbished
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                            <input type="submit" id="btnAdd" class="btn btn-primary"
                                value="Add" />
                        </div>
                    </div>
                </fieldset>
            </form:form>
        </section>
    </body>
    </html>

while doing this jsp i got error, I am new to view part and have little to none knowledge of Jstl el but while learning spring I got stuck in this error which says

Multiple annotations found at this line:

> - Missing end tag for 
> "form:input"
>- Missing end tag for 
> "form:input"

Am I missing something, how to solve this? even a small hint is welcomed too

Thanks


Solution

  • el will also evaluate expressions in comments, so you have to make the tags in comments as it is in "normal" page

    Change

    <!-- Similarly bind <form:input> tag for
        name,unitPrice,manufacturer,category,unitsInStock and unitsInOrder
        fields-->
    

    to

    <!-- Similarly bind <form:input/> tag for
    name,unitPrice,manufacturer,category,unitsInStock and unitsInOrder
    fields-->