Announcement Announcement Module
Collapse
No announcement yet.
addActionError in Springs Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • addActionError in Springs

    Hi,
    I have searched everywhere and i wasnt able to make this work..

    I have a controller, where it gets a source of value(any value). It iterates and determines its success/failure. Now for each failure value it bifurcates and puts it into separate object. At the same it also adds to BindingResult Object 'result'

    Now when the JSP page is rendered, i want to display all the failure value as a error message to the user, while success data being display on the screen.

    I am using the following code to add error in the controller

    Code:
    while(itr1.hasNext())
    {
    	XMLBean xmb = new XMLBean();
    	xmb.setPolicyNo(itr1.next());
    	failurePolicy.add(xmb);
    	result.addError(new ObjectError("111111", "222222"));
    }
    (These 111111 and 222222 are just random string. i don't know its significance)


    This code is wrapped inside a form:form tag and and the controller is returning a new ModelAndView Object
    Code:
    <form:errors path="*"></form:errors>
    After doing this, form:error doesn't renders any error message. Could you tell what wrong have i done ?? I am very much new to Spring. So while posting replies make it as easy as possible to understand.

    This functionality is same as Struts2 addActionError. Where you just to call addActionError with a message. it was very simple with struts2 but i am finding it difficult Spring. I know how bean Validation or ValidationUtil class works but they are limited to only bean property validation
    I am using Spring 3 MVC
Working...
X