Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with JBuilder and Custom tags

Status
Not open for further replies.

ianohlander

Programmer
Feb 28, 2002
12
0
0
US
I have a tag library with two tags: alphaDisplay.class and
categoryDisplay.class. My tld, validated by JBuilder 6, is coctags.tld.
Now realize that when I use those tags just in a Tomcat webapp (the
usual: jsp in root folder, tags in /classes/coctags/ and tld in
/WEB-INF/tlds/) then it works fine. The taglib is located and used to
access the tags. Keep that in mind. It works in Tomcat alone. The tld is
valid, the tags compiled and are accessed properly.

My problem is that I want to use the tags in JBuilder 6. So I created a
coctags.jar- the two tags and then META-INF/taglib (name changed from
coctags.tld)- and configured my new project's (chamberofcommerce.jpx)
library to coctags.jar (and properties to include all). I also put
coctags.tld (not taglib.tld), in /WEB-INF/. Then I altered the jsp that
worked in Tomcat alone so that it referred to the taglib descriptor in
the right place:<%@taglib uri=&quot;/WEB-INF/coctags.tld&quot; prefix=&quot;tags&quot; %>,
instead of &quot;/WEB-INF/tlds/coctags.tld&quot; as in tomcat alone. Finally, I
referred to my tag, as I had in the other, non-Jbuilder implementation,
by &quot;tags&quot;. (In fact the file is just copied and pasted from the other,
with the alteration on the tag-lib descriptor, as I mentioned). I do not
use the web.xml, right now, preferring to refer to the taglib directly,
since I want to get it to work before I start decoupling it for
scalability reasons.

I keep getting the following error:
&quot;tagTest.jsp&quot;: Unable to load class coctags.alphaDisplay at line 14,
column 1

This tells me it is getting the tld, reading it and trying to access the
class, but cannot find it. Yet in the structure pane (top left), under
chamberofcommerce.jpx, there is a node that says &quot;coctags&quot; and when
expanded, shows the two classes. It is there, yet still nothing.

So my question is, what am I doing wrong?
Or even more basic. Assume the existence of a tag library named
coctags.jar that has the following structure:

alphaDisplay.class
categoryDisplay.class
META-INF/
....taglib.tld

Let's say I wanted to use this tag library in JBuilder. What would I do?
What do you do, given a tag library that you KNOW works. Maybe with a
step by step rehash of the details, I can get this to work. I've done
everything I can find to do (and JBuilder 6's documentation on using tag
libraries is non-existant, AFAIK.) I am getting very frustrated.

Thank you,
Ian Ohlander
 
Hi,

I am having the same problem and was wondering if you ever received a solution.

Regards,
Tony B.
 
Hey I also got problems here. Anyone work out whats going on? Here is a copy of my post to another group.
I also get the class not found error.

Hi all,

I have looked all over the net to find out how to do custom tags in
jbhuilder6. I know what I have should work from all the books/articles i
read but i have the following problems.


1) Jbuilder6 wants to go to the internet everytime it reads the tld file to
verify correctness. This is annoying as I don't have a permanent internet
connection. How can I get it to verify against a local copy of the dtd?

2) No matter what I put in the web.xml file for the taglib I cannot
reference it by the taglib URI
The entry I have in the web.xml is as follows:
<taglib>
<taglib-uri>/sabTags</taglib-uri>
<taglib-location>WEB-INF/sabilaTags.tld</taglib-location>
</taglib>
Any attempt to do the following
<%@ taglib uri=&quot;sabilaTags&quot; prefix=&quot;sab&quot; %>
fails with a resource not found error. The following does not get a resource
not found error

<%@ taglib uri=&quot;web-inf/sabilaTags.tld&quot; prefix=&quot;sab&quot; %>


3) The dtd doesn't seem to validate the tld file I copied the DOCTYPE link
from suns examples.

<?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; ?>
<!DOCTYPE taglib
PUBLIC &quot;-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN&quot;
&quot;<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>sab</short-name>
<tag>

I get the following errors.

2002-12-01 19:53:58 - Warning: Unknown element tlib-version in TLD
2002-12-01 19:53:58 - Warning: Unknown element jsp-version in TLD
2002-12-01 19:53:58 - Warning: Unknown element short-name in TLD
2002-12-01 19:53:58 - Warning: Unknown element tag-class in tag
2002-12-01 19:53:58 - Warning: Unknown element body-content in tag


Any help would be appreciated.
 
Hi All,

I think I have found a solution to this problem. Please try it and let me know if it worked for you too. I Use Jbuilder 7.

Apparently, JBuilder doesn't support Tag Libraries that aren't part of a JAR File.

What I did to solve this was to create a Jar Archive using the File->New->Archive Builder Option (Build Tab). I added to this files all the classes that were needed by the tags (That's all the Tag Classes) PLUS the TLD File (adding it as an external resource), that was a part of the source directory.

Then, In the Web Descriptor, under the Tag library descriptor I defined de taglib uri (with the same name as in the TLD File) and the location, pointing to the Jar file, under the WEB-INF directory.

After all this, I compiled a JSP that used the Taglib and it worked fine. Then I Tested with the run option, and also worked.

well, that's it. Please let me know if it worked for you.
Greetings ...

Diego Mansilla
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top