struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leandro Melo <ltcmelo_j...@yahoo.com.br>
Subject Re: Loosing request attributes
Date Fri, 13 Aug 2004 19:49:35 GMT
Vary nice Rick!
Interesting solution, i'll work on that!


 --- Rick Reumann <struttin@reumann.net> escreveu: 
> Leandro Melo wrote:
> 
> > Suppose a user submits a request that is handled
> by
> > MyActionDoSomething. Then this action sets a
> request
> > attribute like this:
> > 
> > request.setAttribute("MyObject", obj); 
> > 
> > and forwards the request to the page
> > myPageDoSomeOtherThing.jsp, wich has some inputs
> for
> > the user to fill in.
> 
> The problem you are describing comes up a lot on
> this list - when 
> validation fails and you are back on the initial
> form you will not have 
> access to the previous set request attributes. It is
> for this reason 
> that I now rarely ever set my mapping validate to
> "true" and instead 
> call validate() from my Action after the form
> submits. The reason for 
> this is when validation fails (ActionErrors/Messages
> return) I can then 
> call a private setUp() method in my Action that is
> used to set up my 
> form with any other request attributes that should
> always be there.
> 
> For example, a common complaint is: "I have a List
> that I set up in 
> request scope that is used on the form for the user
> to select an item, 
> but when validation fails this List will not be
> there." To get around 
> this problem, simply call validate() manually in
> your action and if 
> errors return you can then call a setUp() method
> that will repopulate 
> what you need to be in the request, otherwise you
> just proceed on as 
> normal.
> 
> -- 
> Rick
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
>  

=====



	
	
		
_______________________________________________________
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: http://br.acesso.yahoo.com/

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


Mime
View raw message