File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to access already created bean in jsp

 
khurram mirza
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Pranit Saha
Ranch Hand
Posts: 130
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
U can specify the scope as Application.. see what happens..
Pranit..
 
Marco Barenkamp
Ranch Hand
Posts: 94
  • 0
  • Mark post as helpful
  • send pies
  • 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)
 
Manas Ahlaad
Ranch Hand
Posts: 165
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Bhushan Jawle
Ranch Hand
Posts: 249
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic