Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

using javabeans in sevlets

807598Apr 3 2006 — edited Apr 9 2006
I am have a bean class and i am trying to create an instance of this class in my servlet using the following code.
HttpSession session = request.getSession();
if(session.isNew())
{
FirstBean sBean = (FirstBean)session.getAttribute("sBean");
if(sBean == null)
{
sBean = new FirstBean();
session.setAttribute("sBean",sBean);
}
so on..

when i compile this servlet it give an error.


java:16: cannot resolve symbol
symbol : class FirstBean
location: class College.Nav_homepage
FirstBean sBean = (FirstBean)session.getAttribute("sBean");

i have class FirstBean(compiled and no errors) in the same package as the servlet. but the servlet is giving compiler error. if i move the servlet out of the folder in which the bean class is. the servlet complies but when i am trying to use this bean in a jsp then i get an error.
pls help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2006
Added on Apr 3 2006
4 comments
89 views