Why is document viewing implemented in a servlet instead of a JSP?
A JSP engine preserves white space, such as carriage returns in a JSP file, when it translates the JSP into a servlet. Thus, when a non-ASCII document format, e.g. Microsoft Word, is streamed from the K2 Viewing service to the browser, the added white space may prevent the browser from properly rendering the document. You can map a servlet to a JSP, as shown in the sample templates: The VVStreamer class is a servlet written to stream documents, thus circumventing the JSP engine’s translation phase. The class file, VVStreamer.class, and java file, VVStreamer.java, for this servlet are located in the k2\samples\web\templates\jsp\WEB-INF\classes directory. Additionally, a copy is placed in k2\samples\web\examples\WEB-INF\classes directory for the web context examples. The k2\samples\web\templates\jsp\WEB-INF\web.xml file maps a URL with a JSP to reference this servlet. The mapping in the web.xml file is as follows: