File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes The import attribute of page directive not working for the entire translation unit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "The import attribute of page directive not working for the entire translation unit" Watch "The import attribute of page directive not working for the entire translation unit" New topic
Author

The import attribute of page directive not working for the entire translation unit

Bibhudutta Pradhan
Ranch Hand

Joined: Jun 24, 2011
Posts: 31

index.jsp
--------------
<%@ page import="com.MyClass" %>


<%@include file="included1.jsp" %>


included1.jsp
----------------
<% MyClass myclass = new MyClass(); %>


Exception:
MyClass cannot be resolved to a type


Why ?? I am reading "SCWCD Exam Study Kit". It says that :
"The page directive applies to the entire translation unit and not just to the page in which it is declared."
Please help. Thanks.
Ashok Kurakula
Greenhorn

Joined: May 16, 2011
Posts: 15

Make sure that your class has a public access and your WEB-INF/classes has a proper directory structure.


OCPJP 6, OCE Java EE 6 JSP and Servlets Developer, OCE Java EE 6 EJB Developer...
Bibhudutta Pradhan
Ranch Hand

Joined: Jun 24, 2011
Posts: 31

Thanks Ashok.

Actually the classpath was not set from bin to classes.

Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The import attribute of page directive not working for the entire translation unit
 
Similar Threads
About pageEncoding attribute of page directive
About pageEncoding attribute of page directive
Is this not a valid JSP fragment?
mock question-page directive
SCWCD Study Companion (2nd Edition) errata