About form labels in Spring

Source: Internet
Author: User

 

Add a file header to add the form label of Spring to jsp.

<% @ Taglib prifix = "form" uri = "http://www.springframework.org/tags/form" %>

 

<Form: from name = "user" commandName = "user">

<Table>

<Tr>

<Td> First Name: </td>

<Td> <form: input path = "firstname"/> </td>

</Tr>

<Tr>

<Td> Last Name: </td>

<Td> <form: input path = "lastname"/> </td>

</Tr>

 

<Tr>

<Td colspan = "2"> <input type = "submit" value = "Submit"/> </td>

</Tr>

</Table>

</Form: form>

CommandName = "user", so the attribute of this page must have the user attribute, and the value corresponding to the user attribute must be a form: the bean (class) corresponding to form, so that the page can be correctly displayed, it will not be reported: Neither BindingResult nor plain target object for bean name "user" available as request attribute..

This article is from the "TinyKing" blog

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.