Win a copy of Microservices in Action this week in the Web Services forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Struts 1.0 : When does the action form constructor get called ?  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am maintaining a Struts 1.0 application. I have a session scoped form that gets its default constructor called when I do a GET on a action to display it initially. From there on assuming that the user limits itself to using the forms buttons and controls all calls are POSTS.
But if I go to the address bar and  press the enter key, the default constructor doesn't get called. What is the difference of following a link (a href) to the action and loading it from the address bar ? The former calls the default constructor while the latter doesn't. Since the form is session scoped that kind of explains it, but if i leave the form through a javascript window.location to another page, when I get back in, the constructor gets called again. Shouldn't it be in the session ?

Thanks
 
Daniel Luis dos Santos
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My rubber duck just told me. The constructor is being called because in the page before entering the form you are setting it to null.

Question answared
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!