You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ha...@mummert.de on 2004/04/26 09:24:51 UTC
Form entry/exit
I have major problems of prepopulating a form. Currently I have 3 different
action classes for 40 different forms, each with its own form class. The
form exit is well covered by Struts with the "validate"-method. But there
seems to be no form "entry" method. So I tried to use the
"validate"-method:
String formrequest = null ;
private ActionErrors
entry( ActionMapping mapping, HttpServletRequest request )
{
// Some entry code for prepopulation
}
public ActionErrors
validate( ActionMapping mapping, HttpServletRequest request )
{
//----- Coming from outside
if ( formrequest == null )
return entry ( mapping, request );
String req = formrequest ;
formrequest = null ;
request.removeAttribute ( Constants.KEY_FORMREQUEST );
Unfortunately, "request.removeAttribute" seems to do just nothing ?!?
The best way would be to offer an "entry"-method to pair the validate. Is
there any such planning going on?
Hajo Lemcke
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
AW: Form entry/exit
Posted by Axel Stahlhut <as...@neusta.de>.
Hi Hajo.
For what you call "entry" you can take the reset(...) method. It is
called even before validate.
Request.removeAttribute removes an attribute from tzhe attribute-table.
Attributes are a table of objects within the request, while parameter is
a list of the parsed request paramters. Attribute and Parameter are not
the same. For paramterlist there is no method exposed to remove single
Attributes.
Regards Axel
-----Ursprüngliche Nachricht-----
Von: user-return-111854-astahlhut=neusta.de@struts.apache.org
[mailto:user-return-111854-astahlhut=neusta.de@struts.apache.org] Im
Auftrag von Hajo.Lemcke@mummert.de
Gesendet: Montag, 26. April 2004 09:25
An: user@struts.apache.org
Betreff: Form entry/exit
I have major problems of prepopulating a form. Currently I have 3
different action classes for 40 different forms, each with its own form
class. The form exit is well covered by Struts with the
"validate"-method. But there seems to be no form "entry" method. So I
tried to use the
"validate"-method:
String formrequest = null ;
private ActionErrors
entry( ActionMapping mapping, HttpServletRequest request )
{
// Some entry code for prepopulation
}
public ActionErrors
validate( ActionMapping mapping, HttpServletRequest request )
{
//----- Coming from outside
if ( formrequest == null )
return entry ( mapping, request );
String req = formrequest ;
formrequest = null ;
request.removeAttribute ( Constants.KEY_FORMREQUEST );
Unfortunately, "request.removeAttribute" seems to do just nothing ?!?
The best way would be to offer an "entry"-method to pair the validate.
Is there any such planning going on?
Hajo Lemcke
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org