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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:40:56+00:00 2026-05-23T21:40:56+00:00

I am using spring framework 3. I have a form for posting comments to

  • 0

I am using spring framework 3.
I have a form for posting comments to the article. When the form is submitted, it is checked if there any errors.
In case there is no errors, controller returns string

"redirect:entryView/"+comment.getEntryId();

And everything is okay.

But when there are some errors, if controller returns

"redirect:entryView/"+comment.getEntryId();

The errors should be displaed near the form with spring-form.tld tags:

<form:errors path="author"/>

But there are no displayed errors!
When i am trying to return

"entryView/"+comment.getEntryId();

Without redirect: prefix, then it is going to /rus/WEB-INF/jsp/entryView/8.jsp and there is HTTP Status 404. But it must go to http://example.com/rus/entryView/8, i.e page where the article and form for comments are!

This is view resolver:

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
</bean>

What should i do?

Rest of controller:

@Controller
public class CommentController {
private RusService rusService;
private CommentValidator commentValidator;
@Autowired
public CommentController(RusService rusService,CommentValidator commentValidator){
    this.rusService = rusService;
    this.commentValidator = commentValidator;
}
@RequestMapping(value="/addComment",method=RequestMethod.POST)
public String addComment(Comment comment,BindingResult result){
    commentValidator.validate(comment, result);
    if(result.hasErrors()){
        return "redirect:entryView/"+comment.getEntryId();
    }else{
        rusService.postComment(comment);
        return "redirect:entryView/"+comment.getEntryId();
    }
}
}
  • 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-23T21:40:57+00:00Added an answer on May 23, 2026 at 9:40 pm

    The display of errors in <form:errors path="author"/> works like this:

    • During validation/binding, the Errors are saved as an attribute in the HttpServletResponse object
    • The implementation of this JSP tag calls response.getAttribute(name) to find the Errors instance to display

    When you use redirect:url, you are instructing Spring to send a 302 Found to the client’s browser to force the browser to make a second request, to the new URL.

    Since the redirected-to page is operating with a different set of request/response objects, the original Errors is lost.

    The simplest way to pass “errors” to a page you want to redirect to in order for the new page to display it would be to handle it yourself, by adding a message to the Session object which the second page’s controller can look at (or by passing an argument in the URL).

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

Sidebar

Related Questions

We have started using Spring framework in my project. After becoming acquainted with the
I have a portlet application. It is configured using Spring framework IoC container. I
I have this web application using Spring Web Flow framework. In my main page
I am developing a website using zend framework. i have a search form with
Well, i have a problem validating a form with jQuery. I'm Not using any
I have string like \LESSING\root\cimv2:Win32_UserAccount.Domain=LESSING,Name=Admin How to convert it to LESSING\Admin using Framework?
Our application is developed using Spring framework. Is it good practice to check null
We are developing a web application using Spring framework and Hibernate ORM. As far
For my web application, I am thinking about using the Spring framework. Initially, I
We're securing Mule services using the Spring Security Framework, and some of the services

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.