This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Using <jsp-file> tag in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Using <jsp-file> tag in web.xml " Watch "Using <jsp-file> tag in web.xml " New topic
Author

Using <jsp-file> tag in web.xml

Manjula Weerasinghe
Greenhorn

Joined: Mar 15, 2010
Posts: 25

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

OCPJP 6, OCE JEE 6 JSP and Servlet Developer
Manjula Weerasinghe
Greenhorn

Joined: Mar 15, 2010
Posts: 25

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

Joined: May 16, 2011
Posts: 15

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


OCPJP 6, OCE Java EE 6 JSP and Servlets Developer, OCE Java EE 6 EJB Developer...
Manjula Weerasinghe
Greenhorn

Joined: Mar 15, 2010
Posts: 25

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

Joined: May 16, 2011
Posts: 15

Many thanks Manjula
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using <jsp-file> tag in web.xml