Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When to use session?

 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all i'm trying to send a request from an html form in which i'l provide emp id, uname, and basic salary amount. I want it to be stored in the salary table which contains empid, uname, b salary, hra, ta,da,gross,pf,net sal. can i use session in which it shoul first calculate vlues and store into database and should redirect the user and display salary slip onto the next page where the calculated amount will be called from a salary table and will be displayed in a desired format? Many thanks!!!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this article for a discussion of the best practice flow of control in web apps.

The session is sometimes used to preserve the data across a redirect using the PRG pattern, but it's not always the best way. Usually, in the PRG pattern, the data will be re-pulled from the database via the page controller of the redirect target. There usually isn't a need for the session except when it's been proven that caching data in the session solves a demonstrable performance issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic