aspose file tools*
The moose likes BEA/Weblogic and the fly likes Unable to import the java file into the JSP file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Unable to import the java file into the JSP file." Watch "Unable to import the java file into the JSP file." New topic
Author

Unable to import the java file into the JSP file.

Narasimha Rao B.
Ranch Hand

Joined: Aug 26, 2002
Posts: 205
Hi,

I am working on Bee Weblogic Server 5.1. In one of the JSP file, i am trying to import the java file ("HelloWorld.java"), using the below syntax,
<%@ page import="HelloWorld" %>
JSP file is located at -- <<instal_dir>>/myserver/public_html
and
Java file, "HelloWorld.java" is located at -- <<instal_dir>>/myserver/servletclasses.
I am getting the below error in browser when loading the JSP file,
---------------------
D:\weblogic5.1c\myserver\classfiles\jsp_servlet\_jsp\__man.java:16: '.' expected
probably occurred due to an error in /jsp/man.jsp line 4:
<%@ page import="HelloWorld" %>
--------------------------------
Please help me in solving the above problem.
One more thing, I am getting the error, when creating the instance of any java class, using the below syntax,
---------------------
<%=new SomeJavaFile()%>
------------------------
By the way, the Java file, "SomeJavaFile.java" is located -- <<instal_dir>>/myserver/servletclasses.
But when, i am able to instantiate the frame work classes and the below coding is working fine and i am getting the proper output of the below code,
--------------------
<%=new Date()%>
----------------------------
It seems, JSP file is failing to locate the custom java classes.
Please do help me in solving the problem. I tried a lot to solve, but couldn't.
Thanks in Advance,
Narasimha.


Narasimha
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Moving to the Weblogic forum.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

"import" isn't intended to work with .java files; it imports compiled classes to make them available to the Java code in the JSP. Your HelloWorld and other .java files need to be compiled, then the .class files should be in the classes directory. Finally, if these classes aren't in a named package -- i.e., if there's no "package" statement in the .java file -- then the "import" statement isn't needed anyway, as long as the .class files are available.


[Jess in Action][AskingGoodQuestions]
Narasimha Rao B.
Ranch Hand

Joined: Aug 26, 2002
Posts: 205
Hi Earn,
Thanks a lot for ur help. Here the problem is my class file "HelloWorld.class" is available at <<instal_dir>>/myserver/classfiles.
Still i am getting the same error.
Below i am giving ur statements,
"Your HelloWorld and other .java files need to be compiled, then the .class files should be in the classes directory."
Can you tell me what is the classes directory means? Is it <<instal_dir>>/myserver/classfiles or someother directory. I am not having any directory called as "classes".
Please help me out in solving this problem.
By the way, i am able to import files for jdk lib dir, i.e., below code is working fine,
<%@ page import="java.util.Calendar" %>
Thanks in Advance.
Narasimha.
[ October 04, 2003: Message edited by: narasimha rao bandlamudi ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to import the java file into the JSP file.
 
Similar Threads
Where do to deploy JavaBeans...
import directives for taglib classes?
Null pointer access: The variable out can only be null at this location
Error while exporting to PDF using Jasper Report
UnsupportedClassVersionError