1.jspå¦ä½ä½¿ç¨out.print()
2.Source not found for JspWriterImpl.write(String) line: 338
jspå¦ä½ä½¿ç¨out.print()
out对象çç±»åæ¯JspWriterãJspWriter继æ¿äºjava.io.Writerç±»ãout.print(): è°ç¨çæ¯JspWriterç±»ä¸çæ¹æ³ã
å¨_jspServiceæ¹æ³ä¸æ¥çout对象çå®ä¹,翻转盒子源码å¯ä»¥çå°out对象çç±»å为JspWriter.å¨JSPçAPIç帮å©ææ¡£çjavax.servlet.jspå ä¸ï¼å¯ä»¥æ¾å°JspWriterç帮å©ä¿¡æ¯ï¼JspWriter继æ¿äºjava.io.Writerã
printæ¹æ³æ¯å¨åç±»JspWriterä¸å®ä¹ç,writeræ¹æ³æ¯å¨ç¶ç±»Writerä¸å®ä¹çï¼éè½½çprintæ¹æ³å¯ä»¥å°åç§ç±»åçæ°æ®è½¬æ¢æå符串çå½¢å¼è¾åºï¼èéè½½çwriterç³»åæ¹æ³ä¸è½è¾åºå符ãå符æ°ç»åå符串çä¸å符ç¸å ³çæ°æ®ã
JspWriterç±»åçout对象使ç¨printæ¹æ³åwriteæ¹æ³é½å¯ä»¥è¾åºå符串ï¼ä½æ¯ï¼å¦æå符串对象çå¼ä¸ºnullï¼printæ¹æ³è¾åºå 容为"null"çå符串ï¼èwirteæ¹æ³åä¼æåºNullPointerExceptionå¼å¸¸ã
æ©å±èµæ
JSPä¸out.write()åout.print()çåºå«
out对象çç±»åæ¯JspWriterãJspWriter继æ¿äºjava.io.Writerç±»ã
1ï¼printæ¹æ³æ¯åç±»JspWriterï¼writeæ¯Writerç±»ä¸å®ä¹çæ¹æ³ï¼
2ï¼éè½½çprintæ¹æ³å¯å°åç§ç±»åçæ°æ®è½¬æ¢æå符串çå½¢å¼è¾åºï¼èéè½½çwriteæ¹æ³åªè½è¾åºå符ãå符æ°ç»åå符串çä¸å符ç¸å ³çæ°æ®ï¼
3ï¼JspWriterç±»åçout对象使ç¨printæ¹æ³åwriteæ¹æ³é½å¯ä»¥è¾åºå符串ï¼ä½æ¯ï¼å¦æå符串对象çå¼ä¸ºnullæ¶ï¼printæ¹æ³å°è¾åºå 容为ânullâçå符串ï¼èwriteæ¹æ³åæ¯æåºNullPointerExceptionå¼å¸¸ã
Source not found for JspWriterImpl.write(String) line:
è¿ä¸æ¯é误ï¼èä¸æç¸ä¿¡ä½ è½çæè¿å¥è¯çææï¼ä½äºè¡çJspWriterImplç±»write(String)æ¹æ³æ¾ä¸å°æºä»£ç ã
ä½ è¦è°è¯ï¼èªç¶å¾ææºä»£ç æè¡ãç°å¨ä½ 缺å°ç¸åºç±»çæºä»£ç ï¼æä»¥ä½ è°è¯ä¸è¿å»ï¼ä½ä¸å½±åè¿è¡ã