wood burning stoves 2.0*
The moose likes JSP and the fly likes how to access already created bean in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to access already created bean in jsp" Watch "how to access already created bean in jsp" New topic
Author

how to access already created bean in jsp

khurram mirza
Greenhorn

Joined: Jun 10, 2001
Posts: 25
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

Joined: Sep 09, 2001
Posts: 130
U can specify the scope as Application.. see what happens..
Pranit..
Marco Barenkamp
Ranch Hand

Joined: Aug 27, 2001
Posts: 94
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)


Marco Barenkamp<br />_ _ _ _ _ ________________________ _ _ _ _ _ <br />L M I N T E R N E T S E R V I C E S AG<br /> <br />Head of Software Development<br /> <br /> <br />BEA Certified Enterprise Developer<br />Sun Certified Programmer for the Java2 Platform<br />Sun Certified Web Component Developer for the Java2 Platform<br />Sun Certified Developer for the Java 2 Platform <br />Sun Certified Business Component Developer for the Java 2 Platform <br />Sun Certified Enterprise Architect for the Java 2 Platform Enterprise Edition<br /> <br />LMIS AG
Manas Ahlaad
Ranch Hand

Joined: Nov 07, 2001
Posts: 165
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


Manas<br />Today If You are not Confused,You are just not thinking Clearly !<br />---------------------------------
Bhushan Jawle
Ranch Hand

Joined: Nov 22, 2001
Posts: 249
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to access already created bean in jsp