• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

include Servlet output from a JSP file

 
Greenhorn
Posts: 4
  • 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 include a servlet from a JSP page. Currently, we have quite a few servlets that we need to include on different JSP pages, so this is not just "rewrite the servlet as a jsp" type of project. I have tried the <jsp:include ...> tag, the <c:include ...> tag, the <%@ import ...> tag, and using the RequestDispatcher.include(...) method, all of which have failed. The error message on the log is:

"... handle-processed reports: HTTP2205: The request method is not applicable to the requested resource."

I am not sure if it is a configuration error in the servlet (which is why I posted here) or a problem with the JSP page. It may also be a server configuration error (We are running Sun ONE Web Server). Does anyone know why this occurrs?

Thanks in advance,
Steve

P.S.- Please do not question "why" we are using servlets with JSP pages. We have a variety of web apps using servlets and are just getting into using JSP pages.
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should work without an issue. I'm not familiar with Sun ONE to know if it has issues.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this help?

http://forums.sun.com/thread.jspa?threadID=5117475
 
Steve Dorazio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately this did not help. I am almost positive it is a server configuration error, because I have seen similar posts where people have mentioned including a servlet using <jsp:include ...> without any problems. I have also posted this on Sun's website since it is Sun hardware/software:

http://forums.sun.com/thread.jspa?threadID=5424828

Thanks again for the help. Appreciate the effort.
 
Bear Bibeault
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's have to be a SUn ONE-specific configuration issue. There is no standard configuration that needs to be adjusted.
 
Steve Dorazio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After running several tests, I have found the problem (but not the solution). Each jsp page is run in its own context (default context if its a straight web directory) unless they are in the same directory as the web application. If I move the jsp file to the web app's folder, the <jsp:include...> works fine. Now the problem is enabling cross-context in my web applications/server to get around this issue. Does anyone have a clue if that is even possible? My bets are that is isn't, but just thought I'd try...
 
Steve Dorazio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have found a way to do this. You have to define the context of the include, so the <jsp:include is not correct. instead, use the <c:import like this:

(Add to the top of your page)
<%@taglib uri = "http://java.sun.com/jstl/core" prefix="c"%>

then, where you want to do your include:
<c:import url="(URL from the context. same as in the web.xml)" context="(web app directory here)" />
 
Bear Bibeault
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless you say otherwise, people are going to assume that the resources are all from the same web application.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic