Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher vs. out.println

 
Steve Tharp
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
Steve Tharp
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic