• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to import the java file into the JSP file.

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Weblogic forum.
bear
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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.
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic