beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcelo Morales <>
Subject Keeping validation errors after redirect
Date Sun, 26 Feb 2006 19:52:14 GMT

I will be grateful if you help me solve this one.

This is a typical action inside an application:

         forwards = {
             @Jpf.Forward(name="success", action="mypage")
         useFormBean = "myForm",
         validatableProperties = {
                 propertyName = "name",
                 displayName = "Name",
                 validateRequired = @Jpf.ValidateRequired(),
                 validateMinLength = @Jpf.ValidateMinLength(chars = 5),
                 validateMaxLength = @Jpf.ValidateMaxLength(chars = 32))
         validationErrorForward = @Jpf.Forward(name="fail",  
     public Forward myaction(Form form) {
         /* Some stuff gets done... */
         addActionError("name", "", new Object[] {});
         return new Forward("success");

mypage is a simple action that just forwards the request to a tiles  

Now I want to make all POST redirected, following the Redirect After  
Post idea ( 
l=RedirectAfterPost). So I have changed the forwards like this:

@Jpf.Forward(name="success", action="mypage")
@Jpf.Forward(name="success", action="mypage", redirect=true)

and from
validationErrorForward = @Jpf.Forward(name="fail", action="mypage")
validationErrorForward = @Jpf.Forward(name="fail", action="mypage",  

and i coded the beforeAction and afterAction methods in the  
Controller so i save all messages on the session (when i'm about to  
send the redirection) and retrieve them when i am going to show them.

This works for the "" message, which gets inserted on the  
action; but it does not work for the validation messages because the  
beforeAction and afterAction methods don't get executed when  
validation fails.

How can i keep the validation messages on the session so i can show  
them afterwards?

I was thinking about hacking the validate method in to put all ActionErrors on the session as  
well, but i think this is too intrusive. I am also looking at the  
ActionInterceptor and RequestInterceptor classes (i am about to run  
the samples).

Thanks in advance

Marcelo Morales

View raw message