i have this code in socialmedia.tld as----
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 
1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd";>
<taglib>
        <tlib-version>1.0</tlib-version>
        <jsp-version>2.0</jsp-version>
        <short-name>social-media</short-name>
        <description>This is a demonstration tag library</description>
        <tag>
                <name>fb</name>
                <tag-class>com.test.SocialMedia</tag-class>
                <body-content>empty</body-content>
                <description>This tag is for integrating social 
media</description>
                <attribute>
                        <name>showlike</name>
                        <required>false</required>
                        <rtexprvalue>false</rtexprvalue>
                        <type>boolean</type>
                </attribute>
        </tag>
</taglib>

and jsp page code as=index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="mytest" uri="WEB-INF/socialmedia.tld"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
hfhfhjgfhgf
<mytest:fb showlike="true" />
</body>
</html>

so when i write  socialMedia.java class and use this tld it works in dynamic 
web project in jsp.

but when i want to use this tld file in ftl in freemarker as

<#assign mytest=JspTaglibs["WEB-INF/socialmedia.tld"]>
<html>
  <body>
      <@mytest.fb showlike="true"/>
  </body>       
</html>  


it shows the error=
FreeMarker template error!

java.lang.InstantiationException: com.test.SocialMedia
The problematic instruction:
----------
==> user-directive mytest.fb [on line 6, column 5 in 
templates/components/comp.ftl]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: java.lang.InstantiationException: 
com.test.SocialMedia
        at 
freemarker.ext.jsp.SimpleTagDirectiveModel.execute(SimpleTagDirectiveModel.java:90)
        at freemarker.core.Environment.visit(Environment.java:274)

so please help me how to use the tld file in ftl code so that it will read .tld 
file from that the .java file

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=8b45905f-35ce-4e85-bbbd-2cf7e339294f


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to