Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Which one is best?  RSS feed

 
arulraj michealraj
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which one is best in the following method if you want to pass the data across the page?.
1. putting data by using session object
2. putting data by using hidden form fields

can you please give some example?
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This doesn't have anything to do with XML. It sounds as if it has something to do with servlets, so I will move it over to the Servlets forum and see if anybody there recognizes it.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, I like using a session, as it is much easier.

Having said that, in an exam site I have used a number of hidden fields to keep track of which exam a user is taking, as a user could be taking more than one at a time, and I didn't want that duplicated in the session. So, as much as I love sessions, there are places where using hidden fileds makes sense.

I guess this is one of those questions where there are no right answers, and only wrong answers. Whatever your situation is, just try not to get a wrong answer.

Cheers!

-Cameron McKenzie
[ November 09, 2006: Message edited by: Bear Bibeault ]
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sending data from one page to another can be done in two ways depending on the senario.

* If you are planning to retain some date from one page to another and there is a client in between this , then you should consider storing the data in session.

* And if you are planning to retain some date from one page to another and
there is not client in between then its advisible to put data in request scope.
 
Prem Kashyap
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To Make Rahul's point more clear:
1: Use session attributes to store data which is user specific.
2: Use hidden fields to store data which is application specific or
module specific.

Regards
Prem
SCJP 1.4, Preparing for SCWCD 1.4
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!