struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Germuska <...@Germuska.com>
Subject RE: Pulling Punches
Date Tue, 22 Jun 2004 00:14:34 GMT
At 7:47 PM -0400 6/21/04, Joe Hertz wrote:
>Would making a Struts Action your "input" parameter solve this?

This is not a great solution, for all the reasons that action 
chaining is considered dangerous.  After the validation fails, Struts 
would begin an entire re-execution of the RequestProcessor chain, and 
the archives have plenty of discussion on why that's unpredictable 
and worth avoiding.

One solution you could consider would be to set "validate='false'" in 
struts-config, and then execute logic in your action to test for 
staleness first, and, then, if necessary, reproducing the validation 
which happens in RequestProcessor.processValidate(...)  It's 
basically this:

ActionErrors err = form.validate();
if (err.size() > 0)
{
   saveErrors(...);
   return mapping.getInputForward();
}

It seems to me that you could probably also organize your mapping 
configurations differently, but it's hard for me to make a suggestion 
without a better handle on what's actually going on.  Anyway, this is 
a pretty simple and straightforward solution.

Joe


>
>This way you could do some checking before they made it all the way to
>the input page.
>
>>  -----Original Message-----
>>  From: Mark R. Diggory [mailto:mdiggory@latte.harvard.edu]
>>  Sent: Monday, June 21, 2004 7:33 PM
>>  To: Struts Users Mailing List
>>  Subject: Pulling Punches
>>
>>
>>  Here's an interesting one for ya.
>>
>>  I have a struts action in which I use the "input" parameter
>>  to forward
>>  back to the jsp when validation errors occur (pretty basic).
>>  There is an
>>  instance where an object could be stale once the browser gets into my
>>  Actions execute method, when this is encountered the action
>>  forwards to
>>  an error page that provides a message. This way if anyone
>>  bookmarks the
>>  action, I can show something better than a stack trace when
>>  they return
>>  to the page.
>>
>>  My problem is that I get forwarded back to the input form without
>>  execute occuring and teh stale object being encountered! When
>>  returning
>>  via a bookmark, I get dumped into the JSP designated in the input
>>  attribute. Is there any way I can execute some code to verify
>>  the object
>>  is not stale BEFORE validation occurs?
>>
>>  What it really boils down to is this. Is there a way I can cause an
>>  ActionForward before ActionForm.validate occurs?
>>
>>  -Mark
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn 
back; I'll know I'm in the wrong place."
    - Carlos Santana

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message