jsp:include 不能包含二进制文件

jsp:include cannot include binary file

我正在阅读《Head First Servlet and JSP》一书。有一个问题我不是很明白

我不确定为什么书上说“无法将任何二进制文件的内容导入到 jsp 页面,这会生成 HTML 内容".

为什么上面的说法是正确的?

是不是因为运行时间include一个二进制文件会打开一个新的输入流?

这会导致什么异常?

这是否意味着即使我在编译时而不是 运行 时使用 <%@ include file = "logo.png" @> 包含二进制文件,包含仍然会失败?

测试后

<jsp:include page="banner.png"></jsp:include>

生成未翻译的代码

² /;ÖXÈ%Ïa€wñÉšª1rÂ<š›AÃrðÖŠf'²dPíDuS3=wÄ RiTêÔjO‡²qç™Ûþ”àÕ$'ûv3(YÛ¹ÏÙ&ÜzíuĽþãzŠÛþq=2ÒI_e•5Gä܆àdKÜËÇ 7Ž>â¶s\ŒtÒKÙ×¾ö·vëDæò}û÷ÿdýSžsÅmϸéd¾²¯þå_ÙgÐù+6?ó…ÂSÇ•#¿¡Eg»ÅõÈH's”½cYsDùÇÁóÁÂôʧóÖ›o…ß4v‹ëi´¦)!È VVVX±åÝ'ðâ∼¶/ /žXº…i›YYj:ʇ¼ÛØ„eâùóçYûæÛ,6+¢¬iüdàäÉ“¢Ý∼ú^X;»L@®HN`³yxS¨¨®X²ûS¨Á∼×µlm u(fóKæÔQJÅ,es îõ‡nþ ‹}

<%@ include file = "banner.png" %>

导致 500 服务器错误

HTTP Error Code:   500

Error Message:
/Login.jsp(44,56) java.io.UTFDataFormatException: JSPG0287E: Invalid byte 1 of 1-byte UTF-8 sequence.
Root Cause:
com.ibm.ws.jsp.JspCoreException: /Login.jsp(44,56) java.io.UTFDataFormatException: JSPG0287E: Invalid byte 1 of 1-byte UTF-8 sequence.
    at com.ibm.ws.jsp.translator.document.Jsp2Dom.getJspDocumentAsJspPage(Jsp2Dom.java:529)
    at com.ibm.ws.jsp.translator.document.Jsp2Dom.getJspDocument(Jsp2Dom.java:196)
    at com.ibm.ws.jsp.translator.JspTranslator.<init>(JspTranslator.java:73)
    at com.ibm.ws.jsp.translator.JspTranslatorFactory.createTranslator(JspTranslatorFactory.java:116)
    at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJsp(JspTranslatorUtil.java:262)
    at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJspAndCompile(JspTranslatorUtil.java:123)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:560)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:477)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:298)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:167)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)