aspose file tools*
The moose likes Servlets and the fly likes RequestDispatcher vs. out.println Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher vs. out.println" Watch "RequestDispatcher vs. out.println" New topic
Author

RequestDispatcher vs. out.println

Steve Tharp
Greenhorn

Joined: Mar 19, 2001
Posts: 10
Can anyone tell me their experience on which will offer a better combination of performance and ease of maintenance:
RequestDispatcher forward() to shoot parameters to a .jsp using <% request.getAttribute() %> or having the servlet write out all the HTML with out.println?
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
"having the servlet write out all the HTML with out.println"
That could be a maintenance nightmare depending on the circumstances. Servlets really should not print HTML to the client. That's what JSPs are for


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Steve Tharp
Greenhorn

Joined: Mar 19, 2001
Posts: 10
I totally agree that servlets should not write out the HTML. I am just trying to decide the best way to code our application. I started out using out.println but quickly realized the nightmare of maintaining it. So I am currently using the RequestDispatcher forward() method to populate data in a jsp. I am interested in knowing if anyone has experience with this design and if it hurt performance in any way.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RequestDispatcher vs. out.println
 
Similar Threads
RequestDispatcher.forward()
RequestDispatcher doubts
RequestDispatcher
How to navigate from jsp-to servlets-and again to another -jsp
tomcat return an error +mvc