• 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

A error occured on JSP custom tag...

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I am using a custom tag - that uses a JavaScriptDate bean...i did test it separately it works fine in a Jsp page...
Now, I created a Tag class as JavaScriptDateTag.java that has the following code:
class JavaScriptDateTag extends TagSupport {
public int doStartTag() {
try {
JspWriter out = pageContext.getOut();
JavaScriptDate now = new JavaScriptDate();
out.write(now.getScriptDate());
} catch (IOException e) {
System.out.println("Error in JavaScriptDateTag" +
e.getMessage());
}
return TagSupport.SKIP_BODY;
}
}
----
I also included this tag in JavaScriptDateTag.tld file...as today. this file contains one more tag "message" :
<tag>
<name>today</name>
<tagclass>vlv.mserver.mtags.JavaScriptDate</tagclass>
<info>Display current date</info>
</tag>

<tag>
<name>message</name>
<tagclass>vlv.mserver.mtags.JavaScriptExampleTag</tagclass>
<info>Display Alert Box</info>
</tag>
-----
Now i tried in a JSP page i get an error as follows:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /jsps/tester.jsp
Generated servlet error:
D:\tomcat4.0.6\work\Standalone\localhost\iqc\jsps\tester$jsp.java:60: Method setPageContext(javax.servlet.jsp.PageContext) not found in class vlv.mserver.mtags.JavaScriptDate.
_jspx_th_js_today_0.setPageContext(pageContext);
^
----
The code in jsp page:
<%@ taglib uri="http://www.jsp.com/jspkit/javascript" prefix="js" %>
<html>
<body bgcolor="#ccffff">
Hi, <br> Here follows today's date:<js:today />
<js:message>Hello</js:message>
</body>
</html>
-----
I have refered many books and couldn't get a solution to over come this ...
Anyone pl. guide me... Thanks a lot
 
Vanchi Nathan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all
Thanks a lot , i found the error it was in the "*.tld" file, the <tagclass> tag was pointed to the Javabean instead of the Tag class. Following is the correct code in tld file:
<tag>
<name>today</name>
<tagclass>vlv.mserver.mtags.JavaScriptDateTag</tagclass>
<info>Display current date</info>
</tag>
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic