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 6055921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:19:08+00:00 2026-05-23T08:19:08+00:00

I am writing Web application and trying to integrate Spring Web MVC 3.0 framework.

  • 0

I am writing Web application and trying to integrate Spring Web MVC 3.0 framework. I want to validate input field from XHTML page. The form (what holds one input field) submitted, but then the page is redirected. If you explicitly redirect to the same form (registration.htm) the value entered in the input field disappears, what is not al right. I want the value stay in the input field.
This is my controller:

@Controller
public class UserNameController 
{
    @InitBinder()
    protected void initBinder(WebDataBinder binder) {
        binder.setValidator(new UserNameValidator());
    }


    @RequestMapping(value="userName.htm",method=RequestMethod.POST)
    public ModelAndView userName(@Valid @RequestParam("uName") String uName)
    { System.out.println("__________________________ "+ uName);
     return new ModelAndView("registration");
    }  

  public class UserNameValidator implements Validator 
  {
    public boolean supports(Class<?> clazz) 
    {
       return User.class.isAssignableFrom(clazz);
    }

     public void validate(Object target, Errors errors)
     {
         System.out.println("=======================");
         User user = (User) target;
         ValidationUtils.rejectIfEmptyOrWhitespace(errors, "uName", "field.required", "Required field");
         if(!errors.hasFieldErrors("uName"))
         {
          //   if(user.existUser() == true)
            // {

             //}
         }

     }
  }


}

Validation does not work either. What is the way to get back on the form what would keep entered value?
Best regards

  • 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-23T08:19:08+00:00Added an answer on May 23, 2026 at 8:19 am
    What is the way to get back on the form what would keep entered value?
    

    Do redirect only when you successfully register user, and just return him to registration page when validation fails.

    See also: Problems passing form feedback between controllers to re-display a form error message

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

Sidebar

Related Questions

I'm working on a java web-application, trying to be xml-friendly and writing my jsp
I'm writing a web application using Spring/Hibernate that displays a report to a user,
I am writing an MVC 3 application and I am trying to implement my
I'm trying to add log4net logging to a web application I'm writing. I've got
I'm writing a quick web.py app and take data from web.input... import web urls
I'm trying to parse data from a page of JSON in my ASP.NET MVC
I'm writing an application with Google Web Toolkit and am trying to figure out
When writing a web application which allows the upload of files, one must be
I am writing a web application that requires user interaction via email. I'm curious
I'm writing a web application that decodes Morse Code that is tapped in using

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.