• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP servlet compilation problem

 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting strange errors whilst compiling this simple-tag class for JSP. I know I need to install the Java Servlet API.
I have been to the sun website and downloaded something called:
JavaTM Technology & Web Services
Java Web Services Developer Pack Download
It was an .exe program it found my installation of j2se (or jdk). Is there anything else I need to do? Or have I downloaded the wrong file?

Here is the class:
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class SimpleTag extends javac.seervlet.jsp.tagext.TagSupport
{
public int doStartTag() throws JspExcption
{
try
{
pageContext.getOut().print("Welcome to my Web site.");
}
catch (Exception e)
{
throw new JspTagExcpetion(e.getMessage() );
}
return SKIP_BODY;
}
}

Here is the errors:

public class SimpleTag extends javac.seervlet.jsp.tagext.TagSupport
^
SimpleTag.java:6: cannot resolve symbol
symbol : class JspExcption
location: class SimpleTag
public int doStartTag() throws JspExcption
^
SimpleTag.java:10: cannot resolve symbol
symbol : variable pageContext
location: class SimpleTag
pageContext.getOut().print("Welcome to my Web site.");
^
SimpleTag.java:14: cannot resolve symbol
symbol : class JspTagExcpetion
location: class SimpleTag
throw new JspTagExcpetion(e.getMessage() );
^
SimpleTag.java:16: cannot resolve symbol
symbol : variable SKIP_BODY
location: class SimpleTag
return SKIP_BODY;
^
7 errors
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it appear that you need to include some jar files or lib into your project for compiling.
[ September 11, 2002: Message edited by: Ruilin Yang ]
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>it appear that you need to invlude some jar files or lib into your project for compiling.
Any help what this may be?
Or where I can read about.
The jswdp only gives information on setting path.
I think I it is something to do with Servlet files but not sure what to do???
Please help
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example I use JRun and Kawa. I have to drag some jar files from the directory:
D:\Allaire\JRun\lib to my Kawa project to compile my servlets.
You may need to do similar things.
good luck
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>For example I use JRun and Kawa.
I have never come across this.
My webserver is Tomcat.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by northfield Sid:
>For example I use JRun and Kawa.
I have never come across this.
My webserver is Tomcat.

Here's a link to the full JRun 3.1 build 26414 install for unix and windows. When you install it, don't enter a serial number. It will revert to the free developer edition which is limited to 3 concurrent requests. Docs are available.
[ September 11, 2002: Message edited by: Anthony Villanueva ]
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you include j2ee.jar in your path or project ?
j2ee.jar is from J2sdkee 1.3.1\lib\
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Here's a link to the full JRun 3.1 build 26414 install
Is it not possible to do what I wish with Tomcat and j2se and also jswdp???
I would rather do this since I need to use Tomcat as my final webserver at deployment time.
 
Vedhas Pitkar
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ! try doing this simple thing
import javax.servlet.jsp.tagext.*;
public class Empty{}
If u still get errore then put the location of the servlet.jar file in ur classpath (reboot if 98)Also check if have the correct classpath as reqd by jdk1.4 & catalina.
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vedhas Pitkar: Did what Pitkar suggested,
I created a very simple class:
import javax.servlet.jsp.tagext.*;
public class Empty{}
it gave me one error:
D:\tomcat\jakarta-tomcat-3.3.1\webapps\myJSPs\jsp\Whitehead\chap10>javac Empty.j
ava
Empty.java:1: package javax.servlet.jsp.tagext does not exist
import javax.servlet.jsp.tagext.*;
^
1 error
I than went to my j2sdk-1_3_1 and did search for
servlet.jar and j2ee.jar both times the files were not found. What shall I do???
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found the servlet.jar files at these location:
d:\tomcat\jakarta-tomcat-3.3.1\lib\common
d:\jwsdp-1_0\common\lib
I have put the first path d:\tomcat\...\ since I use tomcat into my autoexec.bat
But I am still unable to compile the programs and so thus get the same errors.
Please note I was unable to find the file j2ee.jar
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to put:
import javax.servlet.*;
in your code
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import javax.servlet.*;
import javax.servlet.jsp.tagext.*;
public class Empty
{}
D:\tomcat\jakarta-tomcat-3.3.1\webapps\myJSPs\jsp\Whitehead\chap10>javac Empty.j
ava
Empty.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
Empty.java:2: package javax.servlet.jsp.tagext does not exist
import javax.servlet.jsp.tagext.*;
^
2 errors
Here is the path:
D:\>path
PATH=C:\JDK1.3.1_02\BIN;C:\WINDOWS;C:\WINDOWS\COMMAND;C:\WINDOWS;C:\;C:\WINDOWS\
COMMAND;C:\JDK1.3.1_02\BIN;D:\JWSDP-1_0\BIN;D:\TOMCAT\JAKARTA-TOMCAT-3.3.1\LIB\C
OMMON;;C:\VISUALCAFE3\BIN;C:\VISUALCAFE3\JAVA\BIN
D:\>
Clearly one can see the lib\common i.e. D:\TOMCAT\JAKARTA-TOMCAT-3.3.1\LIB\C
OMMON;
What am I doing wrong??
Please help me!
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have set the CLASSPATH also but forget to mention this.
I have been using c:\autoexec.bat at the command prompt to make it permanent. This for some reason did not work. I rebooted the computer and now it works.
Thanks for the help.
I will one day fully understand how computers think!!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!