Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

JSP and Servlets

  Asked By: Jodon    Date: Oct 01    Category: Java    Views: 725

Im a total newbie when it comes to JSP and not that much better when
it comes to java. Im hoping somone can help me. I get this error
message when i try and open the JSP page im working on.

Error: 500
Location: /pageA.jsp
Internal Servlet Error:

org.apache.jasper.JasperException: Unable to compile Note:
sun.tools.javac.Main has been deprecated.
C:\jakarta-tomcat-3.3.2\work\DEFAULT\ROOT\pageA_2.java:4: Identifier
import /WEB-INF/classes/message.class;
C:\jakarta-tomcat-3.3.2\work\DEFAULT\ROOT\pageA_2.java:4: Identifier
import /WEB-INF/classes/message.class;
2 errors, 1 warning

at org.apache.tomcat.facade.JasperLiaison.javac
at org.apache.tomcat.facade.JasperLiaison.processJspFile
at org.apache.tomcat.facade.JspInterceptor.preInitCheck
at org.apache.tomcat.facade.ServletHandler.service
at org.apache.tomcat.core.ContextManager.internalService
at org.apache.tomcat.core.ContextManager.service
at org.apache.coyote.tomcat3.Tomcat3Adapter.service
at org.apache.coyote.http11.Http11Processor.process
at org.apache.tomcat.util.net.TcpWorkerThread.runIt
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
at java.lang.Thread.run(Thread.java:534)

This being the peice of code thats causing the problems.

<%@ page import = "/WEB-INF/classes/message.class"%>

Also as an aside, i was wondering is this the correct way to start a

<form name = "frmForm" method = "get" action = "/servlet/message/"
onsubmit = "return validate()">



5 Answers Found

Answer #1    Answered By: Agatha Miller     Answered On: Oct 01

You need not to import  a class  like this
import /WEB-INF/classes/message.class;
rather use a dot "." . However whenever u place your classes in web-inf/classes,
u don't need to import it ,the servlet  container wud automatically recognize the
In case you keep the class in a package like:
WEB-INF/classes/mypackage/message.class, which means there is a directory named
mypackage in WEB-INF/classes which contains your "message.java" file then u'll
have to use this line
<%@ page  import = "mypackage.*"%>

Answer #2    Answered By: Sonya Flores     Answered On: Oct 01

error is in the
<%@ page  import = "/WEB-INF/classes/message.class"%>

instead this use this
<%@ page import="message"%>

problem will be solved. In import  tag you have to
specify the class  name with the package not with path.
and in tomcat  by default it looks for classes into
WEB-INF/class directoy

Answer #3    Answered By: Eric Foster     Answered On: Oct 01

<%@ page  import = "/WEB-INF/classes/message.class"%>

Import statements in JSPs look just like those in regular Java classes, so you
can't do this. Try this instead:

<%@ page import="message" %>

The WEB-INF/classes directory is automatically loaded for you, you just have to
import the classes you want from it. Also, if you want a jar you can put it in
the WEB-INF/lib directory.

And, I think it would also be a really good idea to put message inside a

Answer #4    Answered By: Oliver Evans     Answered On: Oct 01

In Terms of Building your Web Applications...JSP will be much more simpler
that Servlets.

JSP - java  embeded in HTML Code.

Servlets - HTML embeded in Java Code

Anway ultimately JSP will also be converted into Servlet by the container.

In Case of Controlling / Managing your end user Servlets will be deftly.
better than JSP.

In MVC...

M - Model - javabeans & DB
V - View - JSP
Controller - Sevlet

Answer #5    Answered By: Geb Chalthoum     Answered On: Oct 01

u give me very helpfull information

Didn't find what you were looking for? Find more on JSP and Servlets Or get search suggestion and latest updates.