aspose file tools*
The moose likes Struts and the fly likes How to avoid  an  action form to be in session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to avoid  an  action form to be in session" Watch "How to avoid  an  action form to be in session" New topic
Author

How to avoid an action form to be in session

Revanth reddy
Ranch Hand

Joined: Oct 10, 2008
Posts: 52
Ranchers,
Here is my question. I am working on simple web application, there is a scenario, in the front end i will be displaying 2 drop downs(the values are from db) and the two drop downs will be displayed when the page is loaded. if the user selects any one of the drop down then the second drop down needs to be adjusted dynamically based on first drop down value. it is also working fine.

but the problem it is working only when i put the action form in session scope(in struts-config.xml) when i put the form in request scope my program ends up with an exception.. " Failed to obtain Specified Collection". but i seriously wanted the action form to be on request scope.

Then how to achieve this. Any help is greatly appreciated.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
but i seriously wanted the action form to be on request scope


Please explain this. Why do you want the ActionForm to be in the Request scope?
Revanth reddy
Ranch Hand

Joined: Oct 10, 2008
Posts: 52
This is the best practice to have the form to be in request scope, and also i heard that if the form is in session scope , when the app is moved to production ther will be some strange behavior(few times) i am not sure about that. may b i am wrong.. clarify me..

Thanks
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
I don't think that the "best practice" that you mention is really a "best practice." Did you read about this on someone's web page?

There seem to be a bunch of things that you need to test for yourself.

There is no such thing as a single "production environment." There are hundreds of thousands of different "production environments" all around the world.

You should not base you software development practice on individual opinions and things you read on "web sites."

There is nothing wrong with putting an object reference is the session, if it works in your environment and meets your requirements effectively.
Revanth reddy
Ranch Hand

Joined: Oct 10, 2008
Posts: 52
Thanks for the clarification
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to avoid an action form to be in session