| Author |
A error occured on JSP custom tag...
|
Vanchi Nathan
Ranch Hand
Joined: Feb 24, 2004
Posts: 107
|
|
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
|
Best regards,<br /> <br />vanchin
|
 |
Vanchi Nathan
Ranch Hand
Joined: Feb 24, 2004
Posts: 107
|
|
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>
|
 |
 |
|
|
subject: A error occured on JSP custom tag...
|
|
|