form-bean and persistent data in session scope
Dear Erik, In My struts application ,i used 50 form beans in session scope. My application will be accessed by 200 users daily. Does it leads to performance issue ,if using form beans in session. Can you clarify me when does the form bean object would be removed in session scope after it's use. RaghuVeer -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 08, 2005 8:08 AM To: Struts Users Mailing List Subject: Re: form-bean and persistent data This is a valid way to do it. To be more specific, your Action would ask some delegate for the domain object, then it would use that object as either a scoped (request, session, etc.) attribute or as a field for your form-bean (if you are indeed using your form-bean for setup actions as well as for POST-processing actions -- some do this, some don't, but it sounds like you are; when I do this, I use the name attribute in my ActionMapping (but with validate = false) so that Struts will go ahead and instantiate the form-bean for me, and pass it to the execute method). Erik Jonathan M Z wrote: suppose I am using a form-bean to populate an html form, I need to retrieve the values of this form-bean from persistent storage. Do I do this from the Action that eventually forwards to this jsp page? Should I create the form-bean from persistent storage in action.execute(), then forwards the view to the jsp page? for example if the form-bean's name is aBean, in action.execute I create the aBean, populate it, and then set it as an attribute into the request(or whatever scope I see fit) is this a standard approach for reading data into form-bean from the persistent data layer? thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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]
Re: form-bean and persistent data in session scope
As far as I know, Struts never explicitly removes form beans from session scope. This does create the potential for performance issues, simply because those form beans take up memory. With a limited user base, you can probably throw enough RAM into your server to avoid serious problems, though. On Tue, 8 Mar 2005 15:27:17 +0530, Raghuveer Vellanki [EMAIL PROTECTED] wrote: Dear Erik, In My struts application ,i used 50 form beans in session scope. My application will be accessed by 200 users daily. Does it leads to performance issue ,if using form beans in session. Can you clarify me when does the form bean object would be removed in session scope after it's use. RaghuVeer -- Jeff Beal Webmedx, Inc. Pittsburgh, PA USA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: form-bean and persistent data in session scope
Jeff Beal, At some places we have removed the data from session by calling RESET() method of form bean in Action file. But at certain situations we could not use reset for persistence in more then 2 JSP pages. As, we are new for development of our web applications in struts, we could not resolve the issues. With a limited user base, you can probably throw enough RAM into your server to avoid serious problems, though. Moreover many web applications are running at present on customer IBM websphere. we doesn't have control over customer server configrations. Raghu -Original Message- From: Jeff Beal [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 08, 2005 7:43 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: form-bean and persistent data in session scope As far as I know, Struts never explicitly removes form beans from session scope. This does create the potential for performance issues, simply because those form beans take up memory. With a limited user base, you can probably throw enough RAM into your server to avoid serious problems, though. On Tue, 8 Mar 2005 15:27:17 +0530, Raghuveer Vellanki [EMAIL PROTECTED] wrote: Dear Erik, In My struts application ,i used 50 form beans in session scope. My application will be accessed by 200 users daily. Does it leads to performance issue ,if using form beans in session. Can you clarify me when does the form bean object would be removed in session scope after it's use. RaghuVeer -- Jeff Beal Webmedx, Inc. Pittsburgh, PA USA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: form-bean and persistent data in session scope
Hi Raghuveer, You will have to clean up the session yourself. Generally an application will have some type of menu (links). If you follow a naming convention for the mappings for the menu items (mapping seperate than that for the action), you can check for that and clean up the session. This could be done in either a base action or by extending the request processor. - Original Message - From: Raghuveer Vellanki [EMAIL PROTECTED] To: 'Erik Weber' [EMAIL PROTECTED] Subject: form-bean and persistent data in session scope Date: Tue, 8 Mar 2005 15:27:17 +0530 Dear Erik, In My struts application ,i used 50 form beans in session scope. My application will be accessed by 200 users daily. Does it leads to performance issue ,if using form beans in session. Can you clarify me when does the form bean object would be removed in session scope after it's use. RaghuVeer -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 08, 2005 8:08 AM To: Struts Users Mailing List Subject: Re: form-bean and persistent data This is a valid way to do it. To be more specific, your Action would ask some delegate for the domain object, then it would use that object as either a scoped (request, session, etc.) attribute or as a field for your form-bean (if you are indeed using your form-bean for setup actions as well as for POST-processing actions -- some do this, some don't, but it sounds like you are; when I do this, I use the name attribute in my ActionMapping (but with validate = false) so that Struts will go ahead and instantiate the form-bean for me, and pass it to the execute method). Erik Jonathan M Z wrote: suppose I am using a form-bean to populate an html form, I need to retrieve the values of this form-bean from persistent storage. Do I do this from the Action that eventually forwards to this jsp page? Should I create the form-bean from persistent storage in action.execute(), then forwards the view to the jsp page? for example if the form-bean's name is aBean, in action.execute I create the aBean, populate it, and then set it as an attribute into the request(or whatever scope I see fit) is this a standard approach for reading data into form-bean from the persistent data layer? thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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] Antony Joseph http://www.logicden.com https://workeffort.dev.java.net -- ___ NEW! Lycos Dating Search. The only place to search multiple dating sites at once. http://datingsearch.lycos.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
form-bean and persistent data
suppose I am using a form-bean to populate an html form, I need to retrieve the values of this form-bean from persistent storage. Do I do this from the Action that eventually forwards to this jsp page? Should I create the form-bean from persistent storage in action.execute(), then forwards the view to the jsp page? for example if the form-bean's name is aBean, in action.execute I create the aBean, populate it, and then set it as an attribute into the request(or whatever scope I see fit) is this a standard approach for reading data into form-bean from the persistent data layer? thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: form-bean and persistent data
This is a valid way to do it. To be more specific, your Action would ask some delegate for the domain object, then it would use that object as either a scoped (request, session, etc.) attribute or as a field for your form-bean (if you are indeed using your form-bean for setup actions as well as for POST-processing actions -- some do this, some don't, but it sounds like you are; when I do this, I use the name attribute in my ActionMapping (but with validate = false) so that Struts will go ahead and instantiate the form-bean for me, and pass it to the execute method). Erik Jonathan M Z wrote: suppose I am using a form-bean to populate an html form, I need to retrieve the values of this form-bean from persistent storage. Do I do this from the Action that eventually forwards to this jsp page? Should I create the form-bean from persistent storage in action.execute(), then forwards the view to the jsp page? for example if the form-bean's name is aBean, in action.execute I create the aBean, populate it, and then set it as an attribute into the request(or whatever scope I see fit) is this a standard approach for reading data into form-bean from the persistent data layer? thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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]
Re: form-bean and persistent data
Yes, it is typical to write Action.execute() methods that contact the persistent store to populate an ActionForm so that the data can later be rendered by a JSP. Specify what ActionForm (bean) your action uses in struts-config.xml. When you do this, Struts will create/find an instance of that ActionForm for you and stash a reference to it in the scope you have specified. Just use the instance that Struts creates for you (and passes to you via execute an method argument) -- don't create a new one. And don't call request.setAttribute(aBean, actionForm) -- Struts already does that for you (specify the scope in struts-config.xml). My advice in general is to study what Struts does to handle an HTTP request, including the alternate path of handling a validation error. Grasping the basic Struts request handling cycle (even just vaguely, with the good sense to look deeper if you need to at a later date) would help to avoid or solve the majority of Struts-related application bugs or problems that I have experienced. A solid (yet basic) understanding of how HTTP in general works is a fantastic but unfortunately not-so-common thing to have, too. -Max On Mon, 2005-03-07 at 17:51 -0800, Jonathan M Z wrote: suppose I am using a form-bean to populate an html form, I need to retrieve the values of this form-bean from persistent storage. Do I do this from the Action that eventually forwards to this jsp page? Should I create the form-bean from persistent storage in action.execute(), then forwards the view to the jsp page? for example if the form-bean's name is aBean, in action.execute I create the aBean, populate it, and then set it as an attribute into the request(or whatever scope I see fit) is this a standard approach for reading data into form-bean from the persistent data layer? thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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]