• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP load time database updation..

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I am displaying a page to the user, which contains his/her personal
information. I want to update a field in the database that indicates
that the user has been presented the page. The requirement is NOT to
update that field until the info is presented to the user on the browser.
It's a MVC architecture. I could have written the updation code in the
servlet (Handler) just before it forwards the request to the final JSP
(Info page). But in this case we cannot be 100% sure that the user will be presented the page.
So we have to update the field only at the page load time. I had written a BODY onLoad script which would submit the FORM to a servlet the first time. The servlet would take care of the updation and it dispatches the same JSP. But in this case, ReLoad/Refresh effect is observed as the page is loaded ,is submitted and then again finally loaded.
We cannot write the database updation logic in the JSP.

I would really appreciate any suggestions on this.
Thanks in advance.

Cheers,
Udit
 
Udit Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well.. I got the working solution.. that is ..using 2 JSPs in invisible frames..one would show the details and the other one would call the servlet to update the field..
Thanks.

Cheers,
Udit
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"udit" -

Welcome to the JavaRanch! We don't have many rules around the 'Ranch, but we do require your display name to follow the JavaRanch Naming Policy.
You can change it here.


Thanks! and welcome to the JavaRanch!
 
Udit Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Nathan Pruett ,

Thanks for pointing that out and letting me know. I've changed the
screen name.

I was wondering if there are any better approaches for the problem with JSP onLoad updations, mentioned above.
Any response would be highly appreciated.
Thanks.

With Regards,
Udit Singh
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic