There are two possibilities here based on whether the form is request or
session scoped.

If the form is request scoped then you need not worry about it as a single
request gets a single thread and so threading issues are not of concern with
regards to the form being used for the request as each request to a mapping
with a request scoped form will be given its own form instance. Indeed, it
is recommended to use request scoped forms whenever practically possible.

If on the other hand your form is session scoped then it is quite possible
for there to be multiple threads attempting to access it.

This can occur where the user has multiple windows/frames submitting for
that form or even if the user does a double submit - (pressing submit again
causing a second request to be sent before the first has finished).

Something to be especially aware of is that because your actionMapping
determines which key is used to store the form under in the session (through
the name or attribute properties), you wont want to have more than one
browser window for a particluar session using that mapping at a time because
they will interfere with each other as each will be trying to use the same
form instance!

btw: You may wish to look at the support for 'tokens' in struts as a way of
detecting unwanted extra submissions from the browser.

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] Behalf Of kimbuba
Sent: Tuesday, 11 May 2004 18:12
To: [EMAIL PROTECTED]
Subject: is ActionForm thread safe or behaves like Action?


Hello i can't understand if ActionForm is threadsafe.
will all my attribute instance will be safe?

On  RequestUtils i saw :

/**
* Create (if necessary) and return an ActionForm instance appropriate
* for this request. If no ActionForm instance is required, return
* <code>null</code>.
**/
public static ActionForm createActionForm(

What  (if necessary) means?

can i do this:
public class ModifyNewsForm extends ValidatorForm{
private String subject;
[..]
private MyLocaleThreadResource resource;
...

Thanx!




---------------------------------------------------------------------
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]

Reply via email to