Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using <jsp-file> tag in web.xml

 
Manjula Weerasinghe
Greenhorn
Posts: 25
Java Oracle PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I tried to test usage of servlet init parameters inside jsp pages using the tags explained in K & B Head First JSP & Servlets book (in chapter 7).
I tried different ways but when I try to access the relevant JSP page, it gives me "servlet class not found" error. Please see the below
codes and help me to identify the what is the error I am doing here.
Please note that I have removed all the servlet init parameter related stuffs in these codes mentioned in below [wanted to create a basic working example which uses jsp-file tag].

Web.xml file


Exception I am getting when accessing this jsp using /TestParams,


For the JSP page, I tried with several jsp pages including a one which contains only html tags.
like this,


When I tried to access the JSP page directly (using http://localhost:8080/ch7-1/TestParams.jsp), it shows the JSP page without any error.
It gives me this error when I am using url defined in servlet to access this (using http://localhost:8080/ch7-1/TestParams).

I am using Tomcat 7 for testing my web apps.


Thanks & Regards,
Manjula
 
Manjula Weerasinghe
Greenhorn
Posts: 25
Java Oracle PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem resolved.
It seems the problem is with the of the web-app tag of the web.xml.
After I removed that it works fine now.
 
Ashok Kurakula
Greenhorn
Posts: 15
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Manjula,

I really didn't understand, how it solved your problem???

metadata-complete="true" means that the deployment tool only examines the web.xml file and ignores annotations (such as @WebServlet, @WebFilter, and @WebListener present in the class files of the application) and any web-fragment.xml files.

If you remove that attribute from the web-app tag, it will implicitly be set to "false", meaning that the deployment tool will scan all the files for annotations and web-fragment.xml files.

I really don't find any connection bewteen your problem and metadata-complete attribute. Please throw some light on it...

Thanks and Regards,
Ashok
 
Manjula Weerasinghe
Greenhorn
Posts: 25
Java Oracle PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ashok,

Although I am not able to provide any correct and possible explanation for this issue, I can recreate this issue by adding metadata-complete="true" attribute to my web.xml file and this issue disappears once I remove that attribute.
Later I found this thread http://www.coderanch.com/t/520556/JSP/java/Mapped-JSP-Page-not-showing and It seems the reason for that issue is also this "metadata-complete="true"" attribute.

Thanks & Regards,
Manjula
 
Ashok Kurakula
Greenhorn
Posts: 15
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks Manjula
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic