Exception in ActionForm.reset()

2004-02-09 Thread Franck Lefebure
Hello,

How can I handle exception in reset(mapping, request) method

(I would like in this case to forward to a particular mapping)

Thanks

--
Franck Lefebure


Re: HttpServletResponse in ActionForm.reset()

2003-08-21 Thread Jing Zhou
What do you want to do with HttpServletResponse in
ActionForm.reset()?
The reset() method is intended to reset necessary
properties in form beans in case they are not posted
from browsers. If anything gets wrong in the method,
you could throw IllegalArgumentException or
IllegalStataException.

Jing
Netspread Carrier
http://www.netspread.com

- Original Message - 
From: "Jung, Eric (Contractor)" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, August 21, 2003 7:44 AM
Subject: HttpServletResponse in ActionForm.reset()


Hi everyone,
I posted this question a couple days ago, but no one took a bite. Any
suggestions?
I'm trying to get the HttpServletResponse from within the ActionForm.reset()
method. Any ideas?

Thank you in advance for any help...

Sincerely,

Eric H. Jung
Software Engineer
Russell/Mellon Analytical Services
Everett, MA, USA

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



HttpServletResponse in ActionForm.reset()

2003-08-21 Thread Jung, Eric (Contractor)
Hi everyone,
I posted this question a couple days ago, but no one took a bite. Any suggestions?
I'm trying to get the HttpServletResponse from within the ActionForm.reset() method. 
Any ideas?

Thank you in advance for any help...

Sincerely,

Eric H. Jung
Software Engineer
Russell/Mellon Analytical Services
Everett, MA, USA 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to get HttpServletResponse from ActionForm.reset()

2003-08-20 Thread Jung, Eric (Contractor)
Hi everyone,
I've searched the mailing list archives, Google Groups, the JavaDoc, and my 3 Struts 
books, but can't find an answer to this question. Hoping someone on the list can help 
me...

Is there a way to get the HttpServletResponse from ActionForm.reset()?

Here's the method:
  public void reset(ActionMapping mapping, HttpServletRequest request);

Thank you in advance.

Sincerely,

Eric H. Jung
Software Engineer
Russell/Mellon Analytical Services
Everett, MA, USA 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: actionForm.reset() question

2003-01-28 Thread Craig R. McClanahan


On 28 Jan 2003, Jeremy Cavagnolo wrote:

> Date: 28 Jan 2003 12:04:53 -0800
> From: Jeremy Cavagnolo <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: actionForm.reset() question
>
> Does ActionServlet call the reset() method after instantiating an
> ActionForm, but before populating it with the http request parameters?
>

Yes.

> Can anyone point me to a good explanation about how and when
> ActionServlets create ActionForms?
>

I don't suppose looking at the processActionForm() method of ActionServlet
(Struts 1.0) or RequestProcessor (Struts 1.1) would help you ... :-)

A form bean is created if it's not already there in the scope you've
selected (request or session).  In practical terms, that means that the
bean gets created on every request if its in request scope, or just the
first time if its in session scope.

> Thanks!
>
> -Jeremy
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




actionForm.reset() question

2003-01-28 Thread Jeremy Cavagnolo
Does ActionServlet call the reset() method after instantiating an
ActionForm, but before populating it with the http request parameters?

Can anyone point me to a good explanation about how and when
ActionServlets create ActionForms?

Thanks!

-Jeremy

P.S.  As a newbie, I am really enjoying the "Obscure Programming
Languages" thread :)


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: getting MessageResources within ActionForm.reset()

2002-09-22 Thread Taylor, Jason

I got my answer from struts-dev:

MessageResources resources =
(MessageResources) request.getAttribute(Action.MESSAGES_KEY)

So basically anytime you have the request, you've got your resources (and a
fair bit of other stuff too, I imagine).  I'm not sure if this is ideal for
everyone, but it seems better than other options...

-JT

-Original Message-
From: Bryan Hilterbrand [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 21, 2002 11:29 AM
To: Struts Users Mailing List
Subject: Re: getting MessageResources within ActionForm.reset()


Why don't you do your initialization in the action method?

Bryan

- Original Message - 
From: "Taylor, Jason" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 21, 2002 12:06 PM
Subject: getting MessageResources within ActionForm.reset()


Since the ActionServlet.getResources() method is now deprecated, you need a
request and an Action object to get Resources.  That's fine so long as
you're operating within the Action class, but if you're in the ActionForm
object and you want to get Resources, you can't because
Action.getResources(HttpServletRequest) has protected access.  
 
Am I missing something or is this a job for struts-dev?
 
-JT



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



RE: getting MessageResources within ActionForm.reset()

2002-09-21 Thread Taylor, Jason

Because I have a dynamic array of checkboxes which must be created in
reset() before the controller automatically populates the ActionForm.  If I
don't do the initialization in reset(), I can't use the controller to
initialize, populate and validate the form, and I may as well not use an
ActionForm.

Bottom line, there should be a way to get Resources in ActionForm.reset()--
there's no good reason I can see why you'd need system properties in the
Action class but not the ActionForm class.  The reset method receives the
request object, so you don't have the problem that the deprecated
ActionServlet.getResources() method had (i.e., no request argument to
indicate *which* bundle you want).

What I would like to know is why the deprecated method wasn't replaced with
ActionServlet.getResources(HttpServletRequest) rather than
Action.getResources(HttpServletRequest).

Anyone know of any way to get Resources within the ActionForm before I post
it to struts-dev?

-JT

-Original Message-
From: Bryan Hilterbrand [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 21, 2002 11:29 AM
To: Struts Users Mailing List
Subject: Re: getting MessageResources within ActionForm.reset()


Why don't you do your initialization in the action method?

Bryan

- Original Message - 
From: "Taylor, Jason" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 21, 2002 12:06 PM
Subject: getting MessageResources within ActionForm.reset()


Since the ActionServlet.getResources() method is now deprecated, you need a
request and an Action object to get Resources.  That's fine so long as
you're operating within the Action class, but if you're in the ActionForm
object and you want to get Resources, you can't because
Action.getResources(HttpServletRequest) has protected access.  
 
Am I missing something or is this a job for struts-dev?
 
-JT



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



Re: getting MessageResources within ActionForm.reset()

2002-09-21 Thread Bryan Hilterbrand

Why don't you do your initialization in the action method?

Bryan

- Original Message - 
From: "Taylor, Jason" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 21, 2002 12:06 PM
Subject: getting MessageResources within ActionForm.reset()


Since the ActionServlet.getResources() method is now deprecated, you need a
request and an Action object to get Resources.  That's fine so long as
you're operating within the Action class, but if you're in the ActionForm
object and you want to get Resources, you can't because
Action.getResources(HttpServletRequest) has protected access.  
 
Am I missing something or is this a job for struts-dev?
 
-JT



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




getting MessageResources within ActionForm.reset()

2002-09-21 Thread Taylor, Jason

Since the ActionServlet.getResources() method is now deprecated, you need a
request and an Action object to get Resources.  That's fine so long as
you're operating within the Action class, but if you're in the ActionForm
object and you want to get Resources, you can't because
Action.getResources(HttpServletRequest) has protected access.  
 
Am I missing something or is this a job for struts-dev?
 
-JT



RE: ActionForm.reset() method

2001-08-14 Thread Mike Dewhirst

so if I have old data in there, it will be overwritten, plus validate() will
be invoked afterwards if I have validate=true in the config?

-Original Message-
From: Gregor Rayman [mailto:[EMAIL PROTECTED]]
Sent: 14 August 2001 17:02
To: [EMAIL PROTECTED]
Subject: Re: ActionForm.reset() method


"Mike Dewhirst" <[EMAIL PROTECTED]>

> is automatically called when? When the form is first created by the
> Controller?

No, it is called always before the controller populates it from the
request.

--
gR



=**

If you are not the intended recipient, employee or agent responsible for delivering 
the message to the intended recipient, you are hereby notified that any dissemination 
or copying of this communication and its attachments is strictly prohibited.

If you have received this communication and its attachments in error, please return 
the original message and attachments to the sender using the reply facility on e-mail.

Internet communications are not secure and therefore the UCLES Group does not accept 
legal responsibility for the contents of this message.  Any views or opinions 
presented are solely those of the author and do not necessarily represent those of the 
UCLES Group unless otherwise specifically stated.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses although this does not guarantee that 
this email is virus free.

**=



Re: ActionForm.reset() method

2001-08-14 Thread Gregor Rayman

"Mike Dewhirst" <[EMAIL PROTECTED]>

> is automatically called when? When the form is first created by the
> Controller?

No, it is called always before the controller populates it from the
request.

--
gR





ActionForm.reset() method

2001-08-14 Thread Mike Dewhirst

is automatically called when? When the form is first created by the
Controller?


=**

If you are not the intended recipient, employee or agent responsible for delivering 
the message to the intended recipient, you are hereby notified that any dissemination 
or copying of this communication and its attachments is strictly prohibited.

If you have received this communication and its attachments in error, please return 
the original message and attachments to the sender using the reply facility on e-mail.

Internet communications are not secure and therefore the UCLES Group does not accept 
legal responsibility for the contents of this message.  Any views or opinions 
presented are solely those of the author and do not necessarily represent those of the 
UCLES Group unless otherwise specifically stated.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses although this does not guarantee that 
this email is virus free.

**=



Re: ActionForm.reset() not called when form tag creates bean

2001-05-10 Thread John Raley

The problem is that my reset() method populates the form with default values
(the ones I want the user to see when she first gets to the form).

The workaround is to send requests like these through a no-op Action with the
same form type and name.  This will cause the form to be created.  The Action
should have validate="false" in struts-config.xml.  You can use the same
Action class for any situation like this (since the Action itself is a
no-op).

I suppose I could preserve the intent of the reset() method (which I still
don't fully understand) by having all of my ActionForms implement a method
like populateDefaults(mapping, request) and have the action invoke this
method on its form.  But what I have works for now...

Tharwat Abdul-Malik wrote:

> How about not clearing the values in your reset() method (or only clear
> values upon some special condition).
> - Original Message -
> From: "John Raley" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 09, 2001 9:52 PM
> Subject: ActionForm.reset() not called when form tag creates bean
>
> > When the form tag creates its form bean it doesn't invoke reset() on the
> > form.  This (or similar) behavior would be really useful to me - I'm
> > populating the form with runtime-computed default values.
> >
> > Right now I'm considering hacking in a create and a call to reset() on
> > the page (or in a special-purpose tag).  Is there a better way to fill
> > in the form with default values at creation time?
> >
> > Thanks.
> >
> >




Re: ActionForm.reset() not called when form tag creates bean

2001-05-10 Thread Tharwat Abdul-Malik

How about not clearing the values in your reset() method (or only clear
values upon some special condition).
- Original Message -
From: "John Raley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 09, 2001 9:52 PM
Subject: ActionForm.reset() not called when form tag creates bean


> When the form tag creates its form bean it doesn't invoke reset() on the
> form.  This (or similar) behavior would be really useful to me - I'm
> populating the form with runtime-computed default values.
>
> Right now I'm considering hacking in a create and a call to reset() on
> the page (or in a special-purpose tag).  Is there a better way to fill
> in the form with default values at creation time?
>
> Thanks.
>
>




ActionForm.reset() not called when form tag creates bean

2001-05-09 Thread John Raley

When the form tag creates its form bean it doesn't invoke reset() on the
form.  This (or similar) behavior would be really useful to me - I'm
populating the form with runtime-computed default values.

Right now I'm considering hacking in a create and a call to reset() on
the page (or in a special-purpose tag).  Is there a better way to fill
in the form with default values at creation time?

Thanks.




RE: ActionForm.reset()

2001-02-22 Thread Christian Billen

Thanks for your prompt response, I believe it will not work for the
following reason:

My preparation action does thing such as setting collection for html:options
in request attribute.  Imagine that PrepAction initialize a new ActionForm
setting the defaults and overwritting the one created by the controller, we
now forward to the jsp view and all fields are set to their default.  so far
so good.
Next the user enters data, I post that request to the action that
validates...this action makes server call, create some errors and forward
back to preparation handler (because it needs to do so since I have code in
there to build up my collection for the html:options)
Now this prep handler will create a new ActionForm effectively resetting the
one with all the data filled in by the user.  Not the desired effect.

A suggestion would be to configure the defaults value as config parameters
in the struts-config.xml at the Action Mapping level.  Something like
blahsomedefault

Am I making sense of all this?

Thanks,

Christian
> -Original Message-
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 21, 2001 11:13 PM
> To: [EMAIL PROTECTED]
> Subject: Re: ActionForm.reset()
>
>
> Christian Billen wrote:
>
> > Hi list,
> >
> > Is there a way to prevent the reset() method from being called on the
> > ActionForm when the validate option in struts-config for that
> mapping is set
> > to false?
> >
>
> Doing this would break the recommended approach for dealing with
> checkboxes,
> which rely on reset() being called to reset the corresponding booleans to
> false.  You will want this to occur even if you are not
> validating, so that the
> bean properties correctly reflect what the user last entered.
>
> >
> > My problem is that I have an Action to prepare the data for a
> jsp page and
> > another Action to process the data from that jsp. Both point to the same
> > ActionForm class.
> > In my prep action (/prepare.do), I configured the mapping not
> to validate
> > the form, but still I see that the reset() method is being called, very
> > annoying considering that some properties in my actionform are set to a
> > default in the constructor (like a checkbox set to true) and that I have
> > code in reset of the same form to clear checkboxes.  Shouldn't reset be
> > called by the controller only when validate is true?
> >
>
> The Struts example application faces a similar situation.  In the
> EditSubscriptionAction, it creates a new form bean (initialized
> to defaults in
> the constructor) and *replaces* the one that was created by the controller
> servlet (and on which reset() was called).  You might consider
> using a similar
> technique.
>
> Craig McClanahan
>
>
> >
> > Thanks for your advise,
> >
> > Christian Billen
>
>
>




Re: ActionForm.reset()

2001-02-21 Thread Craig R. McClanahan

Christian Billen wrote:

> Hi list,
>
> Is there a way to prevent the reset() method from being called on the
> ActionForm when the validate option in struts-config for that mapping is set
> to false?
>

Doing this would break the recommended approach for dealing with checkboxes,
which rely on reset() being called to reset the corresponding booleans to
false.  You will want this to occur even if you are not validating, so that the
bean properties correctly reflect what the user last entered.

>
> My problem is that I have an Action to prepare the data for a jsp page and
> another Action to process the data from that jsp. Both point to the same
> ActionForm class.
> In my prep action (/prepare.do), I configured the mapping not to validate
> the form, but still I see that the reset() method is being called, very
> annoying considering that some properties in my actionform are set to a
> default in the constructor (like a checkbox set to true) and that I have
> code in reset of the same form to clear checkboxes.  Shouldn't reset be
> called by the controller only when validate is true?
>

The Struts example application faces a similar situation.  In the
EditSubscriptionAction, it creates a new form bean (initialized to defaults in
the constructor) and *replaces* the one that was created by the controller
servlet (and on which reset() was called).  You might consider using a similar
technique.

Craig McClanahan


>
> Thanks for your advise,
>
> Christian Billen




ActionForm.reset()

2001-02-21 Thread Christian Billen

Hi list,

Is there a way to prevent the reset() method from being called on the
ActionForm when the validate option in struts-config for that mapping is set
to false?

My problem is that I have an Action to prepare the data for a jsp page and
another Action to process the data from that jsp. Both point to the same
ActionForm class.
In my prep action (/prepare.do), I configured the mapping not to validate
the form, but still I see that the reset() method is being called, very
annoying considering that some properties in my actionform are set to a
default in the constructor (like a checkbox set to true) and that I have
code in reset of the same form to clear checkboxes.  Shouldn't reset be
called by the controller only when validate is true?

Thanks for your advise,

Christian Billen