-
Action Form Scope in Struts (5 messages)
- Posted by: Abraham Mazumder
- Posted on: December 18 2003 14:19 EST
Hi,
I have read that an ActionForm can be programmed to different scopes - request or session.
But the struts-config.dtd does not mention the form-bean having a "scope" attribute.
Where can the form be scoped then?
Thanks for your time,
AbrahamThreaded Messages (5)
- Action Form Scope in Struts by Hari Lakshmanan on December 18 2003 16:40 EST
- Action Form Scope in Struts by Mathieu Gamache on December 19 2003 07:13 EST
-
Another Question by john walton on June 21 2005 11:21 EDT
- solution for clearing session at the time you dont need. by amit khosla on April 28 2011 06:59 EDT
-
Another Question by john walton on June 21 2005 11:21 EDT
- Action Form Scope in Struts by Mathieu Gamache on December 19 2003 07:13 EST
- Action Form Scope in Struts by mohit srivastava on August 16 2011 15:50 EDT
-
Action Form Scope in Struts[ Go to top ]
- Posted by: Hari Lakshmanan
- Posted on: December 18 2003 16:40 EST
- in response to Abraham Mazumder
Hi,
>
> I have read that an ActionForm can be programmed to different scopes - request or session.
>
> But the struts-config.dtd does not mention the form-bean having a "scope" attribute.
>
> Where can the form be scoped then?
>
> Thanks for your time,
> Abraham
Normally formbean is associated with the Action and Action element has an attribute "scope" where the scope of the ActionForm is specified. Look under action element in the dtd file for more info. -
Action Form Scope in Struts[ Go to top ]
- Posted by: Mathieu Gamache
- Posted on: December 19 2003 07:13 EST
- in response to Hari Lakshmanan
You can use the same action form for many actions and specify the scope for each action as it is needed.
Many developers associate ActionForm classes (form beans) to a single action when they are instead very reusable classes. That is why the scope is not identified in the <form-bean> tag but instead in the <action> tag where it will be used.
Cheers,
Mathieu -
Another Question[ Go to top ]
- Posted by: john walton
- Posted on: June 21 2005 11:21 EDT
- in response to Mathieu Gamache
As I understand it the best practice is to limit the amount of information you store in the session scope this doesn't always get cleared out and can effect performance.
1. Is there a pattern that allows you to define your own scope - between session and request which will be cleared out at a specified point?
2. When you are gathering information on a number of pages should you use one big formbean on a number of small ones? -
solution for clearing session at the time you dont need.[ Go to top ]
- Posted by: amit khosla
- Posted on: April 28 2011 06:59 EDT
- in response to john walton
There is no other area other than session request or application you can write data. For your problem you can write a crown job which can check if there is any thing you want to remove you can. Set a timeout at which the data will be cleaned. The crown job will delete the session objects when timeout reaches.
-
Action Form Scope in Struts[ Go to top ]
- Posted by: mohit srivastava
- Posted on: August 16 2011 15:50 EDT
- in response to Abraham Mazumder
You can always give request scope to your form bean in struts-config file when you map the action . In fact its a good practice and makes the session lighter