• 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

Maintaining the varibles in JSP/ web enabled applications

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,
I m having an application where the no. of inputs are more, near about 70 to 100. So I had divided these inputs in more than one screens say, 10 pages & at the end of 10th page I want all these inputs to be saved. I m facing problem for

how to deal with these many inputs?
how to maintain the values of all these i/p s till the last page?

Some of the i/p from page one is required to manipulate on second page, from 2nd & 3rd page on 4 th page & so on...

What solution I m using is: to maintain the values in session varibles by using methods setAttribute() & getAttribute().

But for all controls is it a good idea to maintain session varibles in the application? I mean is it advantageous or disadvantageous?

Other way to use cookies but again the problem is,every client browser doesn't supports the cookies.

One more way come to my mind is: we can insert the values to temp. tables when move to next page & can retrieve it, when required.But here the problem is, every time we have to connect to the Database.

What is the actual method to follow? I m so confused abt all this. Can anyone, give me the guideline regarding this.
what is the best practise to do in the real application world?

please help me.
thanks & ragrads,
Varsha
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A disadvantage of storing data in database is, if user closes the window without entering all the required details. Some part of the entered data will still remain in the database.

Better to use session.
 
Varsha Pardeshi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chetan Parekh:
A disadvantage of storing data in database is, if user closes the window without entering all the required details. Some part of the entered data will still remain in the database.

Better to use session.



but whether the session variable are reliable to use? I mean 70 to 100 session variable for one iteration.
see if user want to create two designs during his login.Means he will finish one iteration of execution & then again start form first page. so could it work properly in the 2nd iteration also?
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well varsha Pardeshi dis is Indian Amit.Back home to India coz u r pardesi.....OK no kidding :-)


I give only idea try it out...

If u use volatile/transient variable then it may reduce complexity ...I dont know exactly try it out.

When u use dese den u can temp store in these vars i think its in volatile. U store data in these and pass by servlet chaining as u r doing. For DB u try to use these var and call back in next page without conecting to DB...

This purely idea if satisfies m happy....


How the gc() come to know that the objects are no longer usable ? There may be case of objects later may be used....then big dragging back of JVM...is int it...? :-)





["If C & C++ are sea and Java is Ocean/Galaxies/ whole Universe"]

GOOD Question ...keep moving,,


cheers
amit bhadre
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please avoid using abbreviations like 'u' 'dese' 'den', which makes it very difficult to read for non-english speakers.
Thank you
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Varsha!
Can you just post your business requirements?
 
Varsha Pardeshi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chetan Parekh:
Varsha!
Can you just post your business requirements?



hello Chetan,
See my application allows user to create some product design.
For creating design there are no. of inputs. So user may create 1/2 or 3 design when he login into the application.
I just wanted to know the effect or u can say adv. or disadvantage of using more no. of session variables in the web application.
It should not happened that I m using session varibles to maintain the values & at the end of module I will come to know that I had done something wrong.So to avoid doing changes on 11th hours I m just making clear my query or doubt.
And how do u/ java developers maintain the values in the real time web - application that is what I wanted to know?
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Varsha, you said that you will be having collection of 10 screens where user will give all his inputs and screens are inter-dependent upto some extend.

Now my question, Can user give input in few screens first and later on gives for the other screens? Do you need to give this facility? If, yes, then you need to store input in database as you will have to provide facility where user can continue from where he stopped.

If above is not a case, simply store inputs in session. Clear the data from session once you insert them in database.

Create a wrapper Bean (class) and store data in that bean and store that single bean in session � rather then creating multiple objects in session.

Hope I have cleared your doubts.

Revert back me if you have any queries.
 
Varsha Pardeshi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chetan Parekh:
Varsha, you said that you will be having collection of 10 screens where user will give all his inputs and screens are inter-dependent upto some extend.

Now my question, Can user give input in few screens first and later on gives for the other screens? Do you need to give this facility? If, yes, then you need to store input in database as you will have to provide facility where user can continue from where he stopped.

If above is not a case, simply store inputs in session. Clear the data from session once you insert them in database.

Create a wrapper Bean (class) and store data in that bean and store that single bean in session � rather then creating multiple objects in session.

Hope I have cleared your doubts.

Revert back me if you have any queries.




ok thanks, I will Create a wrapper Bean (class) option & if stuck anywhere I will revert back to u.

Thanks to all the participant for u r help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic