File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error

 
gajanan balshetwar
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to execute some simple jstl program.
But tomcat throwing error. Please anyone tell me how to
solve this error.


org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /datetime.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\simpletag\org\apache\jsp\datetime_jsp.java:70: cannot resolve symbol
symbol : class DateTimeTag1
location: class org.apache.jsp.datetime_jsp
DateTimeTag1 _jspx_th_ch06_datetime12_0 = new DateTimeTag1();
^


An error occurred at line: 2 in the jsp file: /datetime.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\simpletag\org\apache\jsp\datetime_jsp.java:70: cannot resolve symbol
symbol : class DateTimeTag1
location: class org.apache.jsp.datetime_jsp
DateTimeTag1 _jspx_th_ch06_datetime12_0 = new DateTimeTag1();
^
2 errors
 
Joe Harry
Ranch Hand
Posts: 10047
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your jsp and associated files here???
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure the DateTimeTag1 class (your class ?) is in the path. Probably under WEB-INF/classes or WEB-INF/lib if it's in a JAR file.
 
gajanan balshetwar
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are diffrent file for tag.please check it.

DateTimeTag.java file in simpletag\WEB-INF\classes directory

import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
public class DateTimeTag extends SimpleTagSupport {
public void doTag() throws JspException, IOException {
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
getJspContext().getOut().write(df.format(new Date()));
}
}
-----------------------------------------------
cho6.tld in simpletag\WEB-INF\tlds

<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
<description>
Tag library for Professional JSP 2.1, Chapter 6.
</description>
<jsp-version>2.1</jsp-version>
<tlib-version>1.0</tlib-version>
<short-name>ch06</short-name>
<uri>http://www.apress.com/projsp/ch06</uri>
<tag>
<name>datetime</name>
<tag-class>DateTimeTag</tag-class>
<body-content>empty</body-content>

<description>
Outputs the current date and time to the page.
</description>
</tag>
</taglib>
----------------------------------------
datetime.jsp

<%@ taglib uri="/WEB-INF/tlds/ch06.tld" prefix="ch06" %>
The current date and time is <ch06 atetime/>
------------------------------------------
 
Dhananjay Inamdar
Ranch Hand
Posts: 130
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Gajanan,

Just want to clarify that you have to keep compiled version of java Soruce file, .class file in WEB-INF/Classes folder. You have mentioned that DateTimeTag.java file is in simpletag\WEB-INF\classes directory. If not already then please compile this DateTimeTag.java and keep DateTimeTag.class file in simpletag\WEB-INF\classes directory.

Thanks
 
gajanan balshetwar
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello dhananjay,
Thanks for reply.I compiled java file and kept in \WEB-INF\classes.
All files kept in all specified location.There is no
compile error in any file. These same problem occurs
for other application.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First,
TLD: <uri>http://www.apress.com/projsp/ch06</uri>
JSP: uri="/WEB-INF/tlds/ch06.tld"
Why are URI different ?

Second,
you really should put your classes into packages.
 
gajanan balshetwar
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Thanks Satou kurinosuke,Dhananjay Inamdar,Jothi Shankar Kumar Sankararaj
for reply. Program now working fine.
 
Dhananjay Inamdar
Ranch Hand
Posts: 130
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Gajanan,

If you got some solution then better post it here, so it will help next person who will visit this forum in search of answer.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic