struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edgar P. Dollin" <ed...@blue-moose.net>
Subject RE: modifying the mapping input path during validation
Date Tue, 17 Dec 2002 18:23:28 GMT
Can this be a property of the form itself?

Edgar

-----Original Message-----
From: Brian Moseley [mailto:bcm@covalent.net] 
Sent: Tuesday, December 17, 2002 1:10 PM
To: struts-dev@jakarta.apache.org
Subject: Re: modifying the mapping input path during validation



any comments on the problem i've outlined below?

i realize that it's not clean to give a form bean any amount of control 
logic (which is what i want to do by allowing it to manipulate the input

path). i'd prefer to avoid this if possible.

one thought is that RequestProcessor.process could offer a "post 
validation" hook that would allow the input path to be specified by an 
application component. but which component? neither actions or forms 
make sense here.

another thought: form definitions in struts-config optionally specify 
sprintf-like format strings which are used by the 
mapping/forward/whatever to dynamically generate paths.

once again, the requirement i have to live with is that my form's input 
page requires a particular request parameter to be set. it's just a form

for modifying the attributes of a model object, and the request 
parameter is simply the object's unique id.

this is clearly a common design pattern; how do other people solve the 
problem of providing a needed request parameter to an action form's 
input after a failed validation?

Brian Moseley wrote:
> 
> i sent the below message to struts-user a couple of days ago. since 
> that
> time i tried to address the problem by creating a subclass of 
> RequestProcessor and overriding the process method. didn't work.
> 
> i figured i could make an "unfrozen clone" of the mapping to pass into
> processValidate, which would allow my form to set the input path
inside 
> its validate method. unfortunately, there was no clean way to do this;
i 
> didn't want to cut and paste processValidate into my subclass, and
there 
> is no hook within process to allow a subclass to step in and create
the 
> mapping clone.
> 
> i wound up having the form set a session attribute which the action 
> then
> gets and removes. a grotesque solution to be sure, but the only
apparent 
> alternative was worse.
> 
> so the question i put to you folks is: how must struts change to allow
> me to modify the mapping's input path inside the form's validate
method? 
> or is there some existing solution that i'm completely missing?
> 
> thanks!
> 
> Brian Moseley wrote:
> 
>> i'm using struts 1.1b2 to perform a simple validation on an action
>> form. it works great, except:
>>
>> when validation fails, i need to specify an additional request
>> parameter for the input path, as the input page requires that 
>> parameter to exist. unfortunately, i get a "configuration frozen" 
>> error when i try to modify the input path in the action form's 
>> validate method.
>>
>> i've considered but rejected using a session attribute instead of a
>> request parameter for this particular piece of data. other than that,

>> is there a solution that i'm missing?
>>
>> thanks!
>>
> 
> 
> 




--
To unsubscribe, e-mail:
<mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message