• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

How to avoid an action form to be in session

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the clarification
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic