• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with visibility of interface class to implementation - JSP related

 
Tyler Wright
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI folks,

I am using tomcat as my servlet container.

I have an interface class Address and an implementation class AddressBean (both are located in):
"webapps/chapter14/WEB-INF/classes/web/Address.class and AddressBean.class"

I have a jsp in directory webapps/chapter14 which has the following jsp directive and action:
<%@ page import="web.*" %>
stuff...
<jsp:useBean id="address" type="web.Address" class="web.AddressBean" scope="session" />

I am using an empty web.xml (just has <web-app> </web-app>.

When I access the jsp that contains the useBean action with: "http://localhost:8080/chapter14/address.jsp"
the following error results:

An error occurred at line: 5 in the jsp file: /address.jsp
The type web.Address is not visible
2:
3:
4:
5: <jsp:useBean id='address' type='web.Address' class='web.AddressBean' scope='session'/>
6: <jsp:setProperty name='address' property='*' />
7:
8: <jsp:forward page="addressDisplay.jsp" >


Can anyone suggest to me why the JSP cannot locate the web.Address class.

Oh, if I remove the "type" attribute from the <jsp:useBean> action, it works fine...

thanks...
 
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe you missed the package declaration in the interface, so it is unable to find such a class?
 
Tyler Wright
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vishwanath Murthi wrote:maybe you missed the package declaration in the interface, so it is unable to find such a class?


I looked at that...both the interface and implementation class are in the package web. The two java files compiled fine using both Eclipse and javac...

10 min...pass...

OMG!
Actually, your idea made me go back and look more carefully at the interface...
The problem was so silly...I forgot to make the interface public...it was package scope only...what a stupid oversight...anyway, thank you Vishwanth...your comment was the key

 
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool, you got it...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic