• 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

Servlet Response

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a strange situation where writing to the response writer works but performing a requestDispatch.include(rq, rs) does not! What I want to write to the response is the result of a jsp that I am trying to include. Am I missing something basic here? Is include different from writing directly to the response writer?

Peace,
Scott
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you trying to get the dispatcher using ServletContext or ServletRequest ?
 
Scott Stanlick
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using:

RequestDispatcher dispatcher = request.getRequestDispatcher(getLocation());
dispatcher.include(request, response);

Shouldn't the output of the "included" JSP be the same as writing directly to the response?
 
Sheriff
Posts: 67746
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
What is happening?
 
Scott Stanlick
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The response is being evaluated by a java script function and when I write to the response myself it works okay. If I include a JSP (that is the same content) it is as though there was no response at all! Is there a way to examine the response following the .include?
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post more portion of your code so that we have understand better what the problem might be?
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Scott,

Please check your private messages for an important administrative matter.

Thanks, Andrew
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is there a way to examine the response following the .include?



If you mean examine what is actually sent to the client - sure. The Firefox browser has great plugins that will capture and show all the bits sent to a web page. I like the Firebug plugin.

You can seee exactly what Javascript is doing, etc etc.

Bill
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you show a full method that makes the .include call and misbehaves? And the JSP that is included as well?

If these are very large please make a mock up that behaves the same way but is a minimal example.

Can you also check your logs and see if an exception occurs during the process? Sometimes these errors get hidden when using JSPs and Servlets because part of the page has been committed before the error occurred.
[ August 17, 2008: Message edited by: Steve Luke ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic