• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP load time database updation..  RSS feed

 
Udit Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!