Ramesh V
Ramesh V

Reputation: 259

Spring Web MVC error handling for non binded parameters

I am using spring web mvc for registering an user. But my User class has a variable of type Website.

public class User{

private String email;

private WebSite website;

}

public class WebSite{

private String webSiteUrl;

}

In my registration form i need 2 text boxes for email and for webSiteUrl.

For email i am using the below way:

<label for="email">Email:</label> <form:errors path="email" cssClass="errors"/> 
<form:input path="email" required="true" placeholder="[email protected]" type="email"/>

How should i map webSiteUrl in jsp and its errors? I tried google but not able to find working solutions, can someone please help me.

Thanks,

Ramesh.V

Upvotes: 0

Views: 303

Answers (1)

arun
arun

Reputation: 86

You may try

<label for="website.webSiteUrl">Website:</label>
<form:errors path="website.webSiteUrl" cssClass="errors"/>
<form:input path="website.webSiteUrl"/>

Haven't tested, but should work..

Upvotes: 1

Related Questions