File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 383

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: 9280
    
  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: 60057
    
  65

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: 383

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?
 
Similar Threads
No nothing works
Error with JBoss and JSF(My Page does not work)
Problem with simple HTML - Servlet login
how to call JSP from Servlet
requested resource not found error