File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes When to use session? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "When to use session?" Watch "When to use session?" New topic
Author

When to use session?

Pranit Sonawane
Ranch Hand

Joined: Jul 29, 2011
Posts: 155

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

Joined: Jan 10, 2002
Posts: 60794
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Consider Paul's rocket mass heater.
 
subject: When to use session?
 
Similar Threads
problem with retiving data please help me?
JSP session tracking problem
Error coming 500 please an code is
Code for Display Calculation salary slip code for eid
Maintaining sessions