• Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaBeans Newbie  RSS feed

 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello;

I am new to this. I have a page that loads up a bean each time the page is loaded.

It was my understanding if the response object doesn't contain the bean a new one will be instainiated.

I am getting these errors (all the same thing):

E:\websites\AuctionsFind\web\work\org\apache\jsp\Contact_jsp.java:48: cannot resolve symbol
symbol : class ContactBean
location: class org.apache.jsp.Contact_jsp
ContactBean contactData = null;
^
E:\websites\AuctionsFind\web\work\org\apache\jsp\Contact_jsp.java:50: cannot resolve symbol
symbol : class ContactBean
location: class org.apache.jsp.Contact_jsp
contactData = (ContactBean) _jspx_page_context.getAttribute("contactData", PageContext.PAGE_SCOPE);
^
E:\websites\AuctionsFind\web\work\org\apache\jsp\Contact_jsp.java:52: cannot resolve symbol
symbol : class ContactBean
location: class org.apache.jsp.Contact_jsp
contactData = new ContactBean();
^
E:\websites\AuctionsFind\web\work\org\apache\jsp\Contact_jsp.java:145: cannot resolve symbol
symbol : class ContactBean
location: class org.apache.jsp.Contact_jsp
out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((ContactBean)_jspx_page_context.findAttribute("contactData")).getAddress())));

Why can't it find my bean?

Thanks,

L
[ October 01, 2004: Message edited by: Luke Shannon ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you don't show the most important thing, which is the content of your jsp:useBean tag, I will guess that you either:
1. don't have the bean class in a package
2. don't correctly refer to the package in the useBean tag
3. don't import the package
4. some combination of the above.
Bill
 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct. No package. I have the class file in the same location as all the other class files for my project. I was hoping they would be able to finding each other if they were all in the same place.

Here is the tag:

<jsp:useBean id="contactData" scope="page" class="ContactBean"/>

Is this a bad strategy?
 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I tried putting the beans in a package. That worked.

The problem is now in my design (this doesn't work like I had hoped).

I need to rethink this a little and hit the books again.

Thanks for the help.

L
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!