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.*" %>
<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
5: <jsp:useBean id='address' type='web.Address' class='web.AddressBean' scope='session'/>
6: <jsp:setProperty name='address' property='*' />
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...
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...
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
Joined: Jun 04, 2007
Cool, you got it...
subject: Problem with visibility of interface class to implementation - JSP related