wood burning stoves 2.0*
The moose likes JSP and the fly likes Is there something wrong with the RequestDispatcher? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Is there something wrong with the RequestDispatcher?" Watch "Is there something wrong with the RequestDispatcher?" New topic
Author

Is there something wrong with the RequestDispatcher?

Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

here's my code ...



the problem is at line no. 5

here's my xml document



http://plainoldjavaobject.blogspot.in
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9305
    
  17

Since you are doing a forward using RequestDispatcher, the JSP which does the forward cannot write any content of its own. Either move this forward as the first line of the JSP page or use an include. Also the logic that you are using in the JSP should not be in a JSP, its not a good design. You can pass your request through either a servlet or a filter which will do this processing...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

Sigh.

The time is long past to stop writing JSPs like it's still 2001. You should not be placing Java code in a JSP... especially code of this nature.

There's is a reason that things have changed; this is one of them


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

well i do not know why ... but its the same code and its working fine now ...



@ Mr. Bear

I am not doing it for some real application ... it was just an experiment code ...
and yes I do take care not to write bad things at bad places ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there something wrong with the RequestDispatcher?