struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Strachan, Paul" <Paul.Strac...@det.nsw.edu.au>
Subject RE: Re: Loss of request attributes after validation form
Date Mon, 29 Jan 2007 11:33:18 GMT
Hi,
 
Can you be more specific regarding the data you are losing on validation?
e.g.
 
1. request attributes
 
when a new request is sent from the browser, the validation may occur before you have an opportunity
to add further request attributes - in this case you should validate in your action code and
set the request attributes you need for your view/jsp.
 
2. properties defined on your DynaForm
 
Your form properties are automatically populated by struts from the request before validation
occurs, so this data should still be on the form when your view is rendered.  Struts form
can be also defined as request or session scope.
 
AFAIK for struts to make a new request following validation error you would need to return
an ActionForward mapping to a URL with redirect=true, using the "input" attribute or your
own forward or global mapping.
 
Thanks,
Paul

________________________________

From: bjorn.de.bakker@accenture.com [mailto:bjorn.de.bakker@accenture.com]
Sent: Mon 1/29/2007 7:10 PM
To: user@struts.apache.org
Subject: RE: Re: Loss of request attributes after validation form



Well, I'm using Struts 1.3.5 and DynaValidatorForm + validation.xml for validation.  We resolved
the issue Friday, by performing some additional steps.  Instead of using DynaValidatorForm,
we created our own class which extends DynaValidatorForm.  After we call the validate-method,
and it fails, we add a new object to the request of the page.  It seems that, after you call
"validate", a new request for the page is being sent, so if you don't add a new object to
it, it "forgets" all those values.

If there are other solutions, please, feel free to share them.

Kind regards

Bjorn De Bakker

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Laurie Harper
Sent: zondag 28 januari 2007 0:26
To: user@struts.apache.org
Subject: Re: Loss of request attributes after validation form

bjorn.de.bakker@accenture.com wrote:
> Ok, I resolved the previous error, but now a new one pops up.
>
> This is the situation:
> We have a database in which we can look up certain persons.  When we find a person, we
have the ability to register him in another database, with additional values.
> If you find a user, you have a button to register him in the other database.  If you
push that button, an object is put in the request in the following action (req.setAttribute("currentUser",
currentUser)).  The next screen shows a form, with a few values already there, retrieved from
the request (<c:out value=${currentUser.firstName} />) and some textfields to supply
additional values (e.g. e-mail).  Now, when I push register, the validation is triggered and
when it fails, you return to this screen.  The problem is that the request is cleared, right
before that, so c:out shows nothing. 
>
> Is there a way to solve this problem?  Or a workaround?

What version of Struts are you using? How are you handling validation?
We will need more details about your setup and configuration to diagnose
this. It sounds like you're doing a redirect after validation, otherwise
the request shouldn't get cleared.

L.


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



This message is for the designated recipient only and may contain privileged, proprietary,
or otherwise private information.  If you have received it in error, please notify the sender
immediately and delete the original.  Any other use of the email by you is prohibited.

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



**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************

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


Mime
View raw message