• 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

how to access already created bean in jsp

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i create a bean instance in first jsp page (i.e <jsp:useBean id="obj" name="Bean" scope="session"> ).and set it attriubtes in same page using jsp:setproperty.i've to access the same bean instance in another jsp page.i could not do so although i've used session as scope.but it does not work.Remember the another jsp page should use same bean instance not create new one.
thanks in advance
khurram mirza
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
U can specify the scope as Application.. see what happens..
Pranit..
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
make sure you used the same ID on the other JSP and make sure
that the session id is stored.
(That means: Either you should use encodeURL on every link or make sure that cookies are enabled in your browser)
------------------
Marco Barenkamp
____________________________________________
L M I N T E R N E T S E R V I C E S AG
Senior Trainer & Architect,
BEA Certified Enterprise Developer
Sun Certified Programmer for the Java2 Platform
Sun Certified Web Component Developer for the Java2 Platform
Sun Certified Developer for the Java 2 Platform
Sun Certified Enterprise Architect for the Java 2 Platform Enterprise Edition (PI)
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have observed the same problem with variables of custom tags in jsp .Even though their scope is entire application they are not accessible outside the current JSP .
I think it is the problem with the JSP to maintain the the variable to its scope
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was facing the same problem.
I think the location of setProperty matters.If it is used in same page as where bean is instantiated and form variables have value=bean's getProperty, the bean though available dosen't store that value. However if you try
1>Posting the form to a different JSP and useBean with same id
2>USE SETPROPERTY HERE
you should be able to access the values from previous form as bean attributes(assumptions here are proper scope of bean is used and property names are appropriate)
Try this, this should work
Regards,
Bhushan
reply
    Bookmark Topic Watch Topic
  • New Topic