From Controller:
@RequestMapping(value = "createcustomer",method = RequestMethod.GET)
public String customer(Model model)
{
Customer cus=new Customer();
cus.setCustomerNumber("Test");
model.addAttribute("customer",cus);
return "createcustomer";
}
In View:
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<div class="cl">
<form:form commandName="customer" method="POST">
<p>Name: <c:out value="${customer.CustomerNumber}"></c:out></p>
</form:form>
<div>
Output:
Name: Test