3

I'm new with jsp pages and just yesterday I opened a similar discussion. This could be a repeat or a very similar one and I'm so sorry whether this is the case, but are just few days that I'm developing jsp pages and I haven't understood how the enviroment, the folders, etc are "linked" together.

I got the following error on Apache Tomcat 7

HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

because I included this taglib

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 

Then, I created a folder "lib" into the "WEB-INF" one and I put there the file jstl-1-2.jar. A user suggested into another discussion reachable from here The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application to remove the standard.jar but I have never had a similar file.

Reading and surfing on the web, I read that in Tomcat 7 should be sufficient to put jstl-1-2.jar into the WEB-INF/lib folder like below but both with and without that file, nothing happen. The error doesen't change.

/var/lib/tomcat7/webapps/jsp_test/web/WEB-INF/lib/jstl-1-2.jar

This is the folders three:

- webapps - ROOT - index.html
                 - META-INF - context.xml

          - jsp_test - nbproject
                     - src - conf - MANIFEST.MF
                           - java - mypack - Display.java

                     - web - ROOT    - index.jsp
                           - WEB-INF - lib       -jstl-1.2.jar
                                     - web.xml
                                     - beans.xml

I noticed also that there's another web.xml file also into the tomcat 7 folder:

/etc/tomcat7/web.xml

Do I have to change something in both the web.xml files?

Moreover, looking in the tomcat7-example folder there is a web.xml file where many libraries are written with a .tld extention:

/usr/share/tomcat7-examples/examples/WEB-INF/web.xml

I lost my way for this stupid thing, help me please! :)

Community
  • 1
  • 1
Roberto Rizzi
  • 1,525
  • 5
  • 26
  • 39

4 Answers4

1

You need to learn how to properly create and deploy a web app on Tomcat.

Get rid of that /web folder under your /jsp_test root. You should just have /WEB-INF and its children under the root.

duffymo
  • 305,152
  • 44
  • 369
  • 561
1

Please go through the content of the url : https://stackoverflow.com/tags/jstl/info. It might help you in resolving your problem.

Community
  • 1
  • 1
Ambuj
  • 63
  • 1
  • 7
1

Like duffymo said je webapp structure should probably look like this: Notice that I also removed the 'ROOT' dir under 'jsp_test' not sure why you added this dir. You can now access your index.jsp directly from the root of your domain.

- webapps - ROOT - index.html
                 - META-INF - context.xml

          - jsp_test - index.jsp
                     - WEB-INF - lib       -jstl-1.2.jar
                               - web.xml
                               - beans.xml

Well i'm curious what url you used to access the index.jsp to get the 500-error?

something like 'http://yourdomain.net/jsp_test/web/ROOT/index.jsp'?

Now the url to acces index.jsp should look like: 'http://yourdomain.net/jsp_test/index.jsp'

I don't know if you configured a context root for you application in tomcat, but if you did and mapped it on 'jsp_test' the url becomes: 'http://yourdomain.net/index.jsp'

If you are just working on a development environment with your tomcat webserver it is also very convenient to place your application in the ROOT webapp of tomcat. Just get rid of the current ROOT webapp and replace it with yours, so your structure will look like:

- webapps - ROOT - index.jsp
                 - WEB-INF - lib       -jstl-1.2.jar
                           - web.xml
                           - beans.xml
ceasaro
  • 595
  • 6
  • 11
  • Thanks a lot for the quick response. I'll try your solution and let you updade about it. About the url, I configured a new host in _server.xml_ file, then i go to the _http://jsp.test:8080/_ Obviously i'm in local enviroment :) – Roberto Rizzi Jul 25 '13 at 09:41
  • If you use the ROOT webapp there no need to configure the server.xml you can just access your application at http://127.0.0.1:8080 – ceasaro Jul 25 '13 at 10:25
  • Yes i know it but i had no problems about the _server.xml_ configuration, in fact it works good on the local domain which i've set up – Roberto Rizzi Jul 25 '13 at 12:56
  • You should not have to touch webapps/ROOT or modify server.xml at all. All you need to do is create a proper WAR file and put that under /webapps. Anything else is the wrong answer. – duffymo Nov 08 '13 at 12:59
0

I think that i've just resolved the issue.

Hoping that the it will be useful for someone, below thers's my solution.

I deleted the old project and i put up a new one in a new directory named "tsp_test" at the same level of the webapps one.

After the set up of a new host into the server.xml, i built a new folder structure for the project:

- tomcat7 - jsp_test - conf
                     - java - mypack - Display.java
                     - test
                     - ROOT - META-INF - context.xml
                            - WEB-INF  - web.xml
                                       - lib         - jstl-1.2.jar
                            - index.jsp

Now i got another error which not concern with the taglib issue:

HTTP Status 500 - Unable to compile class for JSP

I think that it could be because of some class error.

Thank you for the help!

Roberto Rizzi
  • 1,525
  • 5
  • 26
  • 39