Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7034889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:14:23+00:00 2026-05-28T01:14:23+00:00

I have a problem for form validation in a spring 3 mvc application. It

  • 0

I have a problem for form validation in a spring 3 mvc application.

It seems everything is set up, but when a bad entry is enetered in the form field it is detected by validator and no error message is shown.

here’s the validator

@Component
public class SettingsValidator implements Validator{

@Override
public boolean supports(Class<?> clazz) {
    return VrSettings.class.isAssignableFrom(clazz);
}

@Override
public void validate(Object target, Errors errors) {

    ValidationUtils.rejectIfEmpty(errors, "applicationBaseUri", "field.required", "field required");
    ValidationUtils.rejectIfEmpty(errors, "remoteDnsServiceUri","field.required", "field required");

    VrSettings settings = (VrSettings) target;
    try
    {
        URI uri = new URI(settings.getApplicationBaseUri());
    }
    catch (URISyntaxException e)
    {
        errors.rejectValue("applicationBaseUri", "error.invalid.uri", "invalid uri");
    }
    try
    {
        URI uri = new URI(settings.getLocalApplicationBaseURI());
    }
    catch (URISyntaxException e)
    {
        errors.rejectValue("localApplicationBaseURI", "error.invalid.uri", "invalid uri");
    }
    try
    {
        URI uri = new URI(settings.getRemoteDnsServiceUri());
    }
    catch (URISyntaxException e)
    {
        errors.rejectValue("remoteDnsServiceUri", "error.invalid.uri", "invalid uri");
    }

}

}

the controller…

@Controller
public class UserInterfaceController {

@InitBinder
protected void initBinder(WebDataBinder binder)
{
    binder.setValidator(new SettingsValidator());
}


@RequestMapping(method=RequestMethod.POST, value="ui/settings")
public ModelAndView postSettings(@ModelAttribute("settings") @Valid VrSettings settings, BindingResult result)
{
    ModelAndView mav = new ModelAndView("settings");
    mav.addObject("settings", settings);
    if(result.hasErrors())
    {
        mav.addAllObjects(result.getModel());
        return mav;
    }

    LinkedList<VrSettings> vrSettingsList = persistenceManager.getAll(new VrSettings());
    if(vrSettingsList.isEmpty())
    {
        //do things
    }
    else
    {
               //do things
    }

    return mav;
}

}

and finally the JSP

<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

    <h3>Configuration Parameters</h3>

        <span style="font-weight:bold; color: red">
            <form:errors path="*" />
       </span><br />
    <div class="form">
    <form:form method="post" action="settings" commandName="settings">

            <form:label for="baseuri" path="applicationBaseUri">base URI*</form:label>
            <form:input class="text" path="applicationBaseUri" size="35" name="baseuri"/>

            <form:label for="localbaseuri" path="localApplicationBaseURI">local base URI</form:label>
            <form:input class="text" path="localApplicationBaseURI" size="35" name="localbaseuri"/>

            <form:label for="ldns" path="remoteDnsServiceUri">ldns URI*</form:label>
            <form:input class="text" path="remoteDnsServiceUri" size="35" name="ldns"/>

            <div class="form-row">
                <input type="submit" value="submit"/>
            </div>

    </form:form>
    </div>

</body>

I can’t understand what I’m missing.
Any help is appreciated, thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:14:24+00:00Added an answer on May 28, 2026 at 1:14 am
    <form:errors path="*" />
    

    Needs to know what command object it should operate on. So move this tag inside

    <form:form method="post" action="settings" commandName="settings">
    

    without this the method org.springframework.web.servlet.tags.form.AbstractHtmlElementBodyTag.shouldRender() for org.springframework.web.servlet.tags.form.ErrorsTag just returns SKIP_BODY because it can’t find BindingResult for your command object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem using annotated validation in spring 3 mvc. I´m not sure if
I am developing a spring mvc based application. I have a simple pojo form
I have a strange problem with the validation I am writing on a form.
I am preparing a registration page using JSF/Spring webflow&mvc application. I have added two
I have jQuery validation code for a form. However when I set ie9 to
has any one using Spring MVC with Jquery! i have got a strange problem
I'm using Spring MVC 3 and JSR 303. I have a form backing object
I have problem with TinyMCE editor. I have form with few text fields and
I have problem in declaring the intents on my app. I have a form
I have a problem. The client is claiming that a prize signup form I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.