Problems with the generation of spring and JSP expressions

Source: Internet
Author: User

One problem today is the spring tag and the JSP expression.

Directly on the code

<Form:formCommandName= "book"Action= "/book_update"Method= "POST">    <fieldset>        <legend>Edit a book</legend>        <Form:hiddenPath= "id"/>        <P>            <label for= "category">Category:</label>             <Form:selectID= "category"Path= "Category.id"Items= "${categories}"Itemlabel= "Name"Itemvalue= "id"/>        </P>        <P>            <label for= "title">Title:</label>            <Form:inputID= "title"Path= "title"/>        </P>        <P>            <label for= "Author">Author:</label>            <Form:inputID= "Author"Path= "Author"/>        </P>        <P>            <label for= "ISBN">Isbn:</label>            <Form:inputID= "ISBN"Path= "ISBN"/>        </P>                <PID= "Buttons">            <inputID= "Reset"type= "Reset"TabIndex= "4">            <inputID= "Submit"type= "Submit"TabIndex= "5"value= "Update book">        </P>    </fieldset></Form:form>

The problem is that in action= "/book_update" , this action will have a problem at the time of submission, think of the project's basepath, try to do it, but always report a mistake, that is%> Without the right end, the guess was that the code in the spring tag could not be inserted into the Java expression, and later checked to say that the spring tag is compatible with El, so write

Get BasePath

<%basepath= "..."%>

<c:url value= "<%=basepath%> var=" BasePath "/>

Write in action like this

Action= "/' ${basepath} ' Book_update"

This is OK, the core is to use the EL expression do not use the output expression

Add:

<%%> is called java Script (local variable)

<%=%> is called an output expression.

<%! %> is called a JSP declaration (equivalent to a global variable)

<%----%> called JSP annotations

Problems with the generation of spring and JSP expressions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.