• 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

EL functions in Eclipse, Can not find a tag library descriptor for ..., help needed

 
Ranch Hand
Posts: 234
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I am trying to write an EL function. I use Eclipse. I have created three files, class file with public static method, tld file, and jsp file. I got two errors, in two files, one in jsp file, one in tld file. I didn't compiled it and deployed it, I just saw error in an Eclipse, so I didn't tried it. I also use Tomcat.

1) error in a JSP file:
Can not find a tag library descriptor for "X"

2) error in tld file:
The processing instruction must begin with the name of the target

Here are the sources of three files:

seconddoor.jsp

Error is at line 4, at the taglib directive, at the "uri" tag attribute value "X".
Can not find a tag library descriptor for "X"

Next is a tld file, which I created in Eclipse under the web-inf directory with new>file, and then editted it. I didn't found something like wizard for that, and I didn't found option for new>tld fil.

X.tld

Here I have an error under the first line:
The processing instruction must begin with the name of the target

I don't understand that at all.

And also, becaouse JSP file couldn't find tld file, I tried to change <uri> to <taglib-uri>, and tried to change the file name.

And the third, class file...


Funct.java



Thank You...

 
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

In the jsp file use ${mine:randFrom10()} instead of ${mine.randFrom10()} and in the tld file one mandatory tag use <short-name>, rest seems ok to me

try this,

Thanks and welcome.
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sudhakar Sharma. Thank You for Your answer. Still it is not working and I don't know why. To me also it looks ockay. I changed as You writed to me, ${mine:randFrom10()}, and I changed , in tld file, <name>randFrom10<name> into <short-name>. Still I had same errors shown in Eclipse.
I tried to deploy it anyway, and I got SEVERE errors from Tomcat.
SEVERE: Parse Fatal Error at line 1 column 3: The processing instruction must begin with the name of the target

And i also got another severe error from Tomcat
2010.09.15 16:13:46 org.apache.catalina.startup.TldConfig lifecycleEvent
SEVERE: Error processing TLD files for context path /SCWCD
javax.servlet.ServletException: Exception processing TLD at resource path /WEB-INF/X.tld in context /SCWCD
...etc..

When I tried, anyway, in browser, to get to the seconddoor.jsp, I got error:
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: XML parsing error on file /WEB-INF/X.tld: (line 1, col 3)
org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:248)
org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:219)
org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:550)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:382)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:446)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1393)
org.apache.jasper.compiler.Parser.parse(Parser.java:130)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.26



I will try to calm down, and figure out the problem...
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
${mine:randFrom10() }

Actually, on this I get: EL syntax error
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that with NetBeans this thing works, but it doesn't really work in Eclipse. I don't know why, and what is the problem.... Here I sand a screen shots of the code, I know that it's not the best thing to do, but...
fileThree.JPG
[Thumbnail for fileThree.JPG]
fileTwo.JPG
[Thumbnail for fileTwo.JPG]
fileOne.JPG
[Thumbnail for fileOne.JPG]
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And the structure of the project...
projectStructure.JPG
[Thumbnail for projectStructure.JPG]
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that the problem is something with the Eclipse maybe, I think that becaouse there is no something like "create new tld" command, but I am not sure what it is. I attached screenshots becaouse of the way how Eclipse shows errors, becouse I suspected that to someone that might be a usefull information. I will paste text, which is similar to the text I have already pasted, and I will describe what it says in Eclipse, which errors there are.. (but it is not significantly different from the begining of this thread, I think so)...

The new thing that I have done is that I imported jstl.jar and standard.jar. With right click on the project name, I went to the properties, choosed Java Build Path > Libraries tab, and clicked Add External JARs.. I am not sure about many things. I can also Import archive file into a lib subdirectory of web-inf, but if I import it on that way, those two files jstl.jar and standard.jar, then I get question if I want to overwrite manifest.mf, with second import. I am not sure how this is supposed to be done, and what are the effects of different ways of importing those two jars. I'm stuck with an Eclipse, I can't switch to the NetBeans.

Here is the post where I found problem like mine. I am trying to go through it.
https://coderanch.com/t/419548/vc/Error-JSTL-tags-eclipse

It maybe better describes what is my problem, when it comes to the EL functions. Also, it is in forum IDE, Version control and other tools..

I have three files...
Now, after I puted jar files on the java build path, the error from X.tld file is gone (but I am suspitious on that as well, why now is gone)

Before, there was an error on line 1 (The processing instruction must begin with the name of the target ), now I don't have it any more.

Qoute from the thread with parts that describe similar problem, link is above:

I had this terrible problem, trying to use eclipse for El, creating tld, custom tags etc. The support is horrible. (Actually there is none)
I tried something else and it rocks - netBeans.
This has all the features we want. It has excellent wizards for deployment descriptors, tlbs, custom tags etc. Give it a try.


So I think that this is a common problem.

Then, there is this:

Make sure you have the JSTL facet enabled
right-click your project/properties/Project Facets select the JSTL checkbox and version (possibly 1.1 in your case?)


I don't understand this at all, and I don't have that check box...

The thing is that I am trying to persuade Eclipse that it can find a tld file, becouse the file is where it is supposed to be...
Here is the second file, jsp file...

seconddoor.jsp

I have 2 errors. Since I changed mine.randFrom10() into mine:randFrom10(), I got error there. Errors is what Eclipse reports...
1st error:
Line 4: can not find tag library descriptor for "X"

(that is why I took the screen snapshot and attached it, to show where is X.tld file...)

2nd error
Line 12: EL syntax error


In Eclipse, my project looks like this (X is where it shows error):


It used to show error at X.tld file also...

I don't know if it is necessary to have jstl.jar and standard.jar files just to use El functions and tld file.

I also don't know where and how should I import them (if I need them for EL functions) into Eclipse project, like this now with Add External JARs on Java Build Path, as how it shows it in lines 12 and 13, but I think that jar files should be in lib subdirectory, maybe I am wrong, on line 20. When I tried like that, importing two files at the time, I got question if I want to overwrite manifest.mf, but I am not sure what it really happend...

In that other thread which link I included here I didn't find much more informations, except something about JSTL...



I am very thankfull for this. I appologize for too much text. I allready promised my self that I have to do a lot of good things to other people becouse of the help that I got here.
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All people, sorry for throwing on you so many posts. I solved my problem. For now, as I see, if I do everything right, Eclipse shows me an error EL syntax error where I have an EL function in JSP, but when I deploy it, it all works just fine.

Thanks a lot to everyone
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And here is solution for EL syntax error

http://www.eclipse.org/forums/index.php?t=msg&goto=512627&#msg_512627

it is a bug, reports error on no argument EL function calls..

Thank You all a lot...

 
Sudhakar Sharma
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi Sudhakar Sharma. Thank You for Your answer. Still it is not working and I don't know why. To me also it looks ockay. I changed as You writed to me, ${mine:randFrom10()}, and I changed , in tld file, <name>randFrom10<name> into <short-name>. Still I had same errors shown in Eclipse.



I wanted to change ${mine.randFrom10()} into ${mine:randFrom10()} and add one more tag <short-name> just beneath the <taglib> and yes don't change the <name> which is inside the <function>.

And yes you don't need jstl.jar or standard.jar to invoke EL function.

The <short-name> tag is mandatory and it is used by the tools i.e. IDE

hope this will help you

Thanks

 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sudhakar Sharma...

Ahaa... like that.... I was suspecting that it really has meaning what You writed to me, but I don't have enough knowledge about some things... So, I don't know what is <short-name> tag, or probablly I readed it but I forgot it, and I am not sure where to find information about that (I found it, I think) , but also, now I am quite sure that I will understand most of things about that soon..

i think I will find my way through it. I will read a litlle bit today and this days about Tag Library descriptor and JSTL, and things like that, and I have to finish a small web application for my self, so I will get some more understandmant for that matter.

At this point I was just at the begin of those things. And I thank You for Your help, to introduce me a litlle bit, and also, this is really nice "place", JavaRanch...

Thank You one more time, I needed a little bit of conversation to introduce me to El, JSTL, JSP and things... Thank You...... : )
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You, IT WORKED...

I found some article with shortname tag, overthere there was written

<shortname>

not <short-name>

but I am not sure about those differencies now, maybe there are few different versions of the same tag that work the same, I don't know now what is what...

but, with <shortname> I truned on the EL scipting validation (to Error, not Ignore)...

and it still all works...

What You writed to me in the first place was a solution to my confusion. Thank You. I don't know why I am so panicked with EL, JSTL and things, maybe becaouse I am imagining it all together mixed with HTML, JavaScript, other things, CSS, maybe Ajax which I don't know now, and somehow this all just turns on the panic switch in me. But now I am more sure that I will be able to handle all.

 
Sudhakar Sharma
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Petar,

I too don't know very much about the <short-name> tag, but I read it in the HeadFirst SCWCD book and that it is mandatory and used by the tools. And yes, If the things worked correctly it's my pleasure.

You are most welcome

Sudhakar Sharma
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
_ _Nice to meet you_ _
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found it. (!)

<short-name> is mandatory..

: )

BYE
reply
    Bookmark Topic Watch Topic
  • New Topic