• 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

Including resource using Include method using RequestDispatcher

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I'm using include method using RequestDispatcher.
I have two servlet for that.

IncludeServlet.java
===================


Copyright.java
===============


When i tried to run this code i got following output

output
======
Welcome to Our Universe
Imagine the rest of the page here

The requested resource (/Ch06/dispatcher) is not available

=========================

what could be the reason og getting "The requested resource (/Ch06/dispatcher) is not available ".
How to resolve it.

Please Help.

Thanks in Advance.
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you got the Servlet mapping entries in web.xml for the Copyright Servlet.

 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mohamed,

Below is web.xml.


web.xml
======

<servlet>
<servlet-name>IncludeServlet</servlet-name>
<servlet-class>src.com.IncludeServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>Copyright</servlet-name>
<servlet-class>src.com.Copyright</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>IncludeServlet</servlet-name>
<url-pattern>/includeservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Copyright</servlet-name>
<url-pattern>/copyright</url-pattern>
</servlet-mapping>


Thanks for reply.
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



Here request.getRequestDispatcher("/dispatcher") should contain Copyright url pattern from web.xml
 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Balu,

Thanks a lot. I have made changes and now its working.

I want to know one thing.

"If there is a servlet included into another servletn and if there is an entry of invokerServlet in the web.xml (of tomcat directory /conf folder) then can you ignore making an entry of <servlet-mapping> in web.xml for included servet."

Thanks in Advance.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jay,

I guess No. all servlets are to be declared inside the web.xml to be accessed at any way (directly or indirectly).
reply
    Bookmark Topic Watch Topic
  • New Topic