• 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

keeping a bean alive

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear java guru,
I have got series of three .jsp form which is going to be filled by user .
I am using beans with each .jsp form.
Iam also using
ResourceBundle bundle =null;
public void jspInit() {
bundle = ResourceBundle.getBundle("login");
}
so that mapping & validation of form fields to bean fields could be done easly.

For single form I was using scope ="request"
but if I use scope="session" then my field are not getting initialized.
How could I keep my bean initialized with value till the third form so that I could insert in database when all the forms are filled.
I am new to jsp & servlets .
Please advice and help me
kajal sharma
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
basically you need to use a separate jsp session bean to hold the data the you want to persist between pages.
you can use your page worker beans, (the ones you currently have for handling requests parameters), to update the session bean.
on your 3rd page you can get the property values from the session bean, in exactly the same way you would get from your page bean.
hope this helps
 
kajal sharma
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dean tomlinson,
I am having one bean per form to with setter and getter method for all fields in form.
If I am using request I could set and get method for a request.
And as submit button on a second jsp is again a request so my earlier bean object is lost.
How to keep my beans alive till last form and call it in my servlet to insert record in DB
any suggestion
kajal sharma
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Give them plenty of water and sunlight
 
kajal sharma
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using
<jsp:useBean id="report1" class="login.Report1" scope="session" />

is this a way to make session bean.
I am setting the propertires
<jsp:useBean id="report1" class="login.Report1" scope="session">
<jsp:setProperty name="report1" property="*"/>
</jsp:useBean>
but they are null.
If I use scope =request then it is working.
Any help from java guru's
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kajal,
I tested your situation with this sample code. Able to set session scoped bean's properties with incoming request prarameters with "*". Please check.
Also please check the foll. conditions.

[This message has been edited by maha anna (edited March 01, 2001).]
 
kajal sharma
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Maha ,
It is working now.Your help solved my problem.
You are really a great person.
with regards
kajal
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic