Debugging JSP which creates HTML/JavaScript via JspWriter.print() and JspWriter.write()

I am debugging some old code with lots of servlets and JSP which create HTML/JavaScript via JspWriter.print() and JspWriter.write(). Right now only solution taht I can see is to watch for out.print and out.write (JspWriter.print() and JspWriter.write()) buffer in eclipse variable view and then ocassionally copy and paste code into notepad and then remove all those ,[two blank spaces] and ,[one blank space] which will eventually give "properly" formatted JTML with JavaScript.

eclipse debugger
Problem is that buffer flushes on every 8912 bytes. So, I was thinking maybe if I reduce ti (or set to zero?) I could have let's say "real time" preview of print and write. Should I try to decrease buffer size?

Anyway I was also wondering about is there some better, easier method to debug this?

Moreover, I wonder why the authors of original code were using interchangeably both JspWriter.print() and JspWriter.write()? line after line of code. Whet did they accomplish with that?

I know that The write() methods are inherited from the Writer super class. The write() methods can take int, char[], or String types. The print() methods of JspWriter are overloaded for many other types, such as boolean. In the example, the type of the list get() will invoke the corresponding overloaded pint() method for that type. Why not just using print() methods?
KPaxAsked:
Who is Participating?
 
mrcoffee365Commented:
Are you looking at the .java files generated by a servlet engine? out.write and out.print are slightly different.  out.print does a bit more for you, and therefore might be slightly less efficient.  Hence, when the servlet engine chooses to use out.write, they are doing so when it seems as if it will be sufficient, else it chooses out.print.

At this point you would have to look at the source code of tomcat itself, or whatever servlet engine you are using to get a more definitive answer.

If you were working with the original .jsp files, I would expect your question to be quite different.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.