{"id":778,"date":"2024-01-31T02:10:16","date_gmt":"2023-08-25T11:41:52","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/index.php\/2023\/11\/30\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/"},"modified":"2025-08-03T07:27:05","modified_gmt":"2025-08-02T23:27:05","slug":"%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","title":{"rendered":"JSP\u5165\u95e8\u6559\u7a0b\uff1a\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60JavaServer Pages\u7f16\u7a0b\u793a\u4f8b"},"content":{"rendered":"<p>\u6b22\u8fce\u6765\u5230\u9762\u5411\u521d\u5b66\u8005\u7684JSP\u793a\u4f8b\u6559\u7a0b\u3002\u5728\u6700\u8fd1\u51e0\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4ecb\u7ecd\u4e86\u5f88\u591a\u5173\u4e8eJava Servlet\u7684\u5185\u5bb9\uff0c\u5e76\u4e14\u5f97\u5230\u4e86\u8bfb\u8005\u4eec\u7684\u79ef\u6781\u53cd\u9988\u3002\u56e0\u6b64\uff0c\u6211\u5f00\u59cb\u4e86\u53e6\u4e00\u4e2a\u5173\u4e8eJSP\u6559\u7a0b\u7684\u7cfb\u5217\uff0c\u8fd9\u7bc7\u6587\u7ae0\u662f\u7cfb\u5217\u7684\u7b2c\u4e00\u7bc7\u3002<\/p>\n<h2>JSP\u793a\u4f8b\u6559\u7a0b<\/p>\n<p>\u5728\u8fd9\u4e2aJSP\u793a\u4f8b\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u4e86\u89e3JSP\u7684\u57fa\u7840\u77e5\u8bc6\uff0cJSP\u76f8\u5bf9\u4e8eServlet\u7684\u4f18\u52bf\uff0cJSP\u7684\u751f\u547d\u5468\u671f\uff0cJSP API\u63a5\u53e3\u548c\u7c7b\uff0c\u4ee5\u53ca\u6211\u4eec\u53ef\u4ee5\u5c06JSP\u6587\u4ef6\u653e\u5728Web\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u4f4d\u7f6e\u3002\u6211\u4eec\u8fd8\u5c06\u7b80\u8981\u4ecb\u7ecdJSP\u6ce8\u91ca\u3001\u811a\u672c\u5757\u3001\u6307\u4ee4\u3001\u8868\u8fbe\u5f0f\u3001\u58f0\u660e\u548cJSP\u5c5e\u6027\u3002\u5176\u4e2d\u4e00\u4e9b\u4e3b\u9898\u975e\u5e38\u91cd\u8981\uff0c\u6211\u4eec\u5c06\u5728\u4ee5\u540e\u7684\u5e16\u5b50\u4e2d\u66f4\u8be6\u7ec6\u5730\u8ba8\u8bba\u5b83\u4eec\u3002<\/p>\n<h3>JSP \u6559\u7a0b<\/p>\n<ol>JSP\u662f\u4ec0\u4e48\uff0c\u4e3a\u4ec0\u4e48\u6211\u4eec\u9700\u8981JSP\uff1f<br \/>\nJSP\u6bd4Servlet\u7684\u4f18\u52bf\u662f\u4ec0\u4e48\uff1f<br \/>\nJSP\u9875\u9762\u7684\u751f\u547d\u5468\u671f\u662f\u4ec0\u4e48\uff1f<br \/>\nJSP\u7684\u751f\u547d\u5468\u671f\u65b9\u6cd5\u662f\u4ec0\u4e48\uff1f<br \/>\n\u5728Eclipse\u548cTomcat\u4e0a\u7684\u7b80\u5355JSP\u793a\u4f8b<br \/>\nWeb\u5e94\u7528\u7a0b\u5e8fWAR\u6587\u4ef6\u4e2dJSP\u6587\u4ef6\u7684\u4f4d\u7f6e<br \/>\nJSP\u7684API\u63a5\u53e3\u548c\u7c7b\u6709\u54ea\u4e9b\uff1f<\/ol>\n<ul class=\"post-ul\">\n<li>JspPage Interface<\/li>\n<li>HttpJspPage Interface<\/li>\n<li>JspWriter abstract Class<\/li>\n<li>JspContext abstract Class<\/li>\n<li>PageContext abstract Class<\/li>\n<li>JspFactory abstract Class<\/li>\n<li>JspEngineInfo abstract Class<\/li>\n<li>ErrorData final Class<\/li>\n<li>JspException Class<\/li>\n<li>JspTagException Class<\/li>\n<li>SkipPageException Class<\/li>\n<\/ul>\n<ol>JSP\u6ce8\u91ca<\/p>\n<p>JSP\u811a\u672c\u5143\u7d20<\/p>\n<p>JSP\u8868\u8fbe\u5f0f<\/p>\n<p>JSP\u6307\u4ee4<\/p>\n<p>JSP\u58f0\u660e<\/p>\n<p>\u5728Tomcat\u4e2d\u7684JSP\u8f6c\u6362\u7684Servlet\u6e90\u4ee3\u7801\u548c\u7c7b\u6587\u4ef6\u4f4d\u7f6e<\/p>\n<p>JSP\u521d\u59cb\u5316\u53c2\u6570<\/p>\n<p>\u91cd\u5199JSP init()\u65b9\u6cd5<\/p>\n<p>JSP\u4e2d\u7684\u5c5e\u6027<\/p>\n<p>\u4ec0\u4e48\u662fJSP\u4ee5\u53ca\u4e3a\u4ec0\u4e48\u6211\u4eec\u9700\u8981JSP\uff1f<br \/>\nJSP\uff08JavaServer Pages\uff09\u662f\u4e00\u79cd\u670d\u52a1\u5668\u7aef\u6280\u672f\uff0c\u7528\u4e8e\u521b\u5efa\u52a8\u6001\u7684Java Web\u5e94\u7528\u7a0b\u5e8f\u3002JSP\u53ef\u4ee5\u770b\u4f5c\u662fServlet\u6280\u672f\u7684\u6269\u5c55\uff0c\u56e0\u4e3a\u5b83\u63d0\u4f9b\u4e86\u8f7b\u677e\u521b\u5efa\u7528\u6237\u89c6\u56fe\u7684\u529f\u80fd\u3002JSP\u9875\u9762\u5305\u542bHTML\u4ee3\u7801\uff0c\u5e76\u63d0\u4f9b\u4e86\u5728\u52a8\u6001\u5185\u5bb9\u4e2d\u5305\u542bJava\u4ee3\u7801\u7684\u9009\u9879\u3002\u7531\u4e8eWeb\u5e94\u7528\u7a0b\u5e8f\u5305\u542b\u5f88\u591a\u7528\u6237\u754c\u9762\uff0c\u6240\u4ee5JSP\u5728Web\u5e94\u7528\u7a0b\u5e8f\u4e2d\u88ab\u5e7f\u6cdb\u4f7f\u7528\u3002\u4e3a\u4e86\u5f25\u5408JSP\u4e2dJava\u4ee3\u7801\u548cHTML\u4e4b\u95f4\u7684\u5dee\u8ddd\uff0c\u5b83\u63d0\u4f9b\u4e86\u989d\u5916\u7684\u529f\u80fd\uff0c\u6bd4\u5982JSP\u6807\u7b7e\u3001\u8868\u8fbe\u5f0f\u8bed\u8a00\u3001\u81ea\u5b9a\u4e49\u6807\u7b7e\u3002\u8fd9\u4f7f\u5f97\u7406\u89e3\u5b83\u53d8\u5f97\u5bb9\u6613\uff0c\u5e76\u5e2e\u52a9Web\u5f00\u53d1\u4eba\u5458\u5feb\u901f\u5f00\u53d1JSP\u9875\u9762\u3002<\/p>\n<p>JSP\u76f8\u5bf9\u4e8eServlet\u7684\u4f18\u52bf\uff1f<\/p>\n<p>\u6211\u4eec\u4e5f\u53ef\u4ee5\u4eceServlet\u751f\u6210HTML\u54cd\u5e94\uff0c\u4f46\u662f\u5728\u7f16\u5199\u590d\u6742\u7684HTML\u54cd\u5e94\u65f6\uff0c\u7f16\u5199Servlet\u5c06\u662f\u4e00\u573a\u5669\u68a6\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cJSP\u80fd\u591f\u5e2e\u52a9\u6211\u4eec\u7f16\u5199\u666e\u901a\u7684HTML\u9875\u9762\uff0c\u5e76\u53ea\u5728\u9700\u8981\u7684\u5730\u65b9\u5305\u542b\u6211\u4eec\u7684Java\u4ee3\u7801\u3002<\/p>\n<p>JSP\u63d0\u4f9b\u4e86\u989d\u5916\u7684\u529f\u80fd\uff0c\u6bd4\u5982\u6807\u7b7e\u5e93\u3001\u8868\u8fbe\u5f0f\u8bed\u8a00\u3001\u81ea\u5b9a\u4e49\u6807\u7b7e\uff0c\u8fd9\u6709\u52a9\u4e8e\u66f4\u5feb\u5730\u5f00\u53d1\u7528\u6237\u89c6\u56fe\u3002<\/p>\n<p>JSP\u9875\u9762\u6613\u4e8e\u90e8\u7f72\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5c06\u4fee\u6539\u540e\u7684\u9875\u9762\u66ff\u6362\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u5bb9\u5668\u4f1a\u8d1f\u8d23\u90e8\u7f72\u3002\u5bf9\u4e8eServlet\uff0c\u6211\u4eec\u9700\u8981\u91cd\u65b0\u7f16\u8bd1\u548c\u90e8\u7f72\u6574\u4e2a\u9879\u76ee\u3002\u5b9e\u9645\u4e0a\uff0cServlet\u548cJSP\u662f\u76f8\u8f85\u76f8\u6210\u7684\u3002\u6211\u4eec\u5e94\u8be5\u4f7f\u7528Servlet\u4f5c\u4e3a\u670d\u52a1\u5668\u7aef\u63a7\u5236\u5668\u5e76\u4e0e\u6a21\u578b\u7c7b\u8fdb\u884c\u901a\u4fe1\uff0c\u800c\u5e94\u8be5\u4f7f\u7528JSP\u8fdb\u884c\u8868\u793a\u5c42\u3002<\/p>\n<p>JSP\u9875\u9762\u7684\u751f\u547d\u5468\u671f<br \/>\nJSP\u9875\u9762\u7684\u751f\u547d\u5468\u671f\u4e5f\u7531\u5bb9\u5668\u7ba1\u7406\u3002\u901a\u5e38\uff0c\u5305\u542bServlet\u5bb9\u5668\u7684\u6bcf\u4e2aWeb\u5bb9\u5668\u4e5f\u5305\u542b\u7528\u4e8e\u7ba1\u7406JSP\u9875\u9762\u7684JSP\u5bb9\u5668\u3002JSP\u9875\u9762\u7684\u751f\u547d\u5468\u671f\u9636\u6bb5\u5982\u4e0b\uff1a<\/p>\n<p>\u7ffb\u8bd1 &#8211; JSP\u9875\u9762\u4e0d\u50cf\u666e\u901a\u7684Java\u7c7b\uff0c\u5b9e\u9645\u4e0aJSP\u5bb9\u5668\u89e3\u6790JSP\u9875\u9762\u5e76\u5c06\u5176\u8f6c\u6362\u4e3a\u76f8\u5e94\u7684Servlet\u6e90\u4ee3\u7801\u3002\u5982\u679cJSP\u6587\u4ef6\u540d\u662fhome.jsp\uff0c\u901a\u5e38\u547d\u540d\u4e3ahome_jsp.java\u3002<\/p>\n<p>\u7f16\u8bd1 &#8211; \u5982\u679c\u7ffb\u8bd1\u6210\u529f\uff0c\u5219\u5bb9\u5668\u7f16\u8bd1\u751f\u6210\u7684Servlet\u6e90\u6587\u4ef6\u4ee5\u751f\u6210\u7c7b\u6587\u4ef6\u3002<\/p>\n<p>\u7c7b\u52a0\u8f7d &#8211; \u4e00\u65e6JSP\u88ab\u7f16\u8bd1\u4e3aServlet\u7c7b\uff0c\u5b83\u7684\u751f\u547d\u5468\u671f\u5c31\u7c7b\u4f3c\u4e8eServlet\uff0c\u5e76\u88ab\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\u3002<\/p>\n<p>\u5b9e\u4f8b\u5316 &#8211; \u5728JSP\u7c7b\u52a0\u8f7d\u5230\u5185\u5b58\u540e\uff0c\u5bb9\u5668\u5b9e\u4f8b\u5316\u5b83\u7684\u5bf9\u8c61\u3002<\/p>\n<p>\u521d\u59cb\u5316 &#8211; \u7136\u540e\u521d\u59cb\u5316JSP\u7c7b\uff0c\u5e76\u5c06\u5176\u4ece\u666e\u901a\u7c7b\u8f6c\u6362\u4e3aServlet\u3002\u521d\u59cb\u5316\u540e\uff0cServletConfig\u548cServletContext\u5bf9\u8c61\u53ef\u4ee5\u88abJSP\u7c7b\u8bbf\u95ee\u3002<\/p>\n<p>\u8bf7\u6c42\u5904\u7406 &#8211; \u5bf9\u4e8e\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8bf7\u6c42\uff0c\u90fd\u4f1a\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u7ebf\u7a0b\uff0c\u5e26\u6709ServletRequest\u548cServletResponse\u6765\u5904\u7406\u5e76\u751f\u6210HTML\u54cd\u5e94\u3002<\/p>\n<p>\u9500\u6bc1 &#8211; JSP\u751f\u547d\u5468\u671f\u7684\u6700\u540e\u9636\u6bb5\uff0c\u5c06\u5176\u5378\u8f7d\u51fa\u5185\u5b58\u3002<\/p>\n<p>JSP\u7684\u751f\u547d\u5468\u671f\u65b9\u6cd5<br \/>\nJSP\u7684\u751f\u547d\u5468\u671f\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>jspInit() &#8211; \u5728JspPage\u63a5\u53e3\u4e2d\u58f0\u660e\u3002\u8be5\u65b9\u6cd5\u5728JSP\u751f\u547d\u5468\u671f\u4e2d\u4ec5\u88ab\u8c03\u7528\u4e00\u6b21\uff0c\u7528\u4e8e\u521d\u59cb\u5316\u914d\u7f6e\u53c2\u6570\u3002<\/p>\n<p>_jspService(HttpServletRequest request, HttpServletResponse response) &#8211; \u5728HttpJspPage\u63a5\u53e3\u4e2d\u58f0\u660e\uff0c\u7528\u4e8e\u5904\u7406\u5ba2\u6237\u7aef\u8bf7\u6c42\u5e76\u751f\u6210\u54cd\u5e94\u3002<\/p>\n<p>jspDestroy() &#8211; \u5728JspPage\u63a5\u53e3\u4e2d\u58f0\u660e\uff0c\u7528\u4e8e\u5c06JSP\u4ece\u5185\u5b58\u4e2d\u5378\u8f7d\u3002<\/p>\n<p>\u4f7f\u7528Eclipse\u548cTomcat\u7684\u7b80\u5355JSP\u793a\u4f8b<\/ol>\n<pre class=\"post-pre\"><code>We can use Eclipse IDE for building dynamic web project with JSPs and use Tomcat to run it. Please read [Java Web Applications](\/community\/tutorials\/java-web-application-tutorial-for-beginners#first-web-app-servlet) tutorial to learn how can we easily create JSPs in Eclipse and run it in tomcat. A simple JSP example page example is: `home.jsp`\r\n\r\n```\r\n&lt;%@ page language=\"java\" contentType=\"text\/html; charset=US-ASCII\"\r\n    pageEncoding=\"US-ASCII\"%&gt;\r\n&lt;!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\" \"https:\/\/www.w3.org\/TR\/html4\/loose.dtd\"&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=US-ASCII\"&gt;\r\n&lt;title&gt;First JSP&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;%@ page import=\"java.util.Date\" %&gt;\r\n&lt;body&gt;\r\n&lt;h3&gt;Hi Pankaj&lt;\/h3&gt;&lt;br&gt;\r\n&lt;strong&gt;Current Time is&lt;\/strong&gt;: &lt;%=new Date() %&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n```\r\n\r\nIf you have a simple JSP that uses only JRE classes, we are not required to put it as WAR file. Just create a directory in the tomcat webapps folder and place your JSP file in the newly created directory. For example, if your JSP is located at apache-`tomcat\/webapps\/test\/home.jsp`, then you can access it in browser with URL `https:\/\/localhost:8080\/test\/home.jsp`. If your host and port is different, then you need to make changes in URL accordingly.\r\n<\/code><\/pre>\n<ol>\u5728Web\u5e94\u7528\u7a0b\u5e8fWAR\u6587\u4ef6\u4e2d\u7684JSP\u6587\u4ef6\u4f4d\u7f6e<\/ol>\n<pre class=\"post-pre\"><code>We can place JSP files at any location in the WAR file, however if we put it inside the WEB-INF directory, we wont be able to access it directly from client. We can configure JSP just like servlets in web.xml, for example if I have a JSP example page like below inside WEB-INF directory: `test.jsp`\r\n\r\n```\r\n&lt;%@ page language=\"java\" contentType=\"text\/html; charset=US-ASCII\"\r\n    pageEncoding=\"US-ASCII\"%&gt;\r\n&lt;!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\" \"https:\/\/www.w3.org\/TR\/html4\/loose.dtd\"&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=US-ASCII\"&gt;\r\n&lt;title&gt;Test JSP&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\nTest JSP Page inside WEB-INF folder.&lt;br&gt;\r\nInit Param \"test\" value =&lt;%=config.getInitParameter(\"test\") %&gt;&lt;br&gt;\r\nHashCode of this object=&lt;%=this.hashCode() %&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n```\r\n\r\nAnd I configure it in web.xml configuration as:\r\n\r\n```\r\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;web-app xmlns:xsi=\"https:\/\/www.w3.org\/2001\/XMLSchema-instance\" xmlns=\"https:\/\/java.sun.com\/xml\/ns\/javaee\" xsi:schemaLocation=\"https:\/\/java.sun.com\/xml\/ns\/javaee https:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_3_0.xsd\" version=\"3.0\"&gt;\r\n  &lt;display-name&gt;FirstJSP&lt;\/display-name&gt;\r\n  \r\n  &lt;servlet&gt;\r\n  &lt;servlet-name&gt;Test&lt;\/servlet-name&gt;\r\n  &lt;jsp-file&gt;\/WEB-INF\/test.jsp&lt;\/jsp-file&gt;\r\n  &lt;init-param&gt;\r\n  \t&lt;param-name&gt;test&lt;\/param-name&gt;\r\n  \t&lt;param-value&gt;Test Value&lt;\/param-value&gt;\r\n  &lt;\/init-param&gt;\r\n  &lt;\/servlet&gt;\r\n  \r\n  &lt;servlet-mapping&gt;\r\n  &lt;servlet-name&gt;Test&lt;\/servlet-name&gt;\r\n  &lt;url-pattern&gt;\/Test.do&lt;\/url-pattern&gt;\r\n  &lt;\/servlet-mapping&gt;\r\n  \r\n  &lt;servlet&gt;\r\n  &lt;servlet-name&gt;Test1&lt;\/servlet-name&gt;\r\n  &lt;jsp-file&gt;\/WEB-INF\/test.jsp&lt;\/jsp-file&gt;\r\n  &lt;\/servlet&gt;\r\n  \r\n  &lt;servlet-mapping&gt;\r\n  &lt;servlet-name&gt;Test1&lt;\/servlet-name&gt;\r\n  &lt;url-pattern&gt;\/Test1.do&lt;\/url-pattern&gt;\r\n  &lt;\/servlet-mapping&gt;\r\n&lt;\/web-app&gt;\r\n```\r\n\r\nThen I can access it with both the URLs https:\/\/localhost:8080\/FirstJSP\/Test.do and https:\/\/localhost:8080\/FirstJSP\/Test1.do Notice that container will create two instances in this case and both will have their own servlet config objects, you can confirm this by visiting these URLs in browser. For Test.do URI, you will get response like below.\r\n\r\n```\r\nTest JSP Page inside WEB-INF folder.\r\nInit Param \"test\" value =Test Value\r\nHashCode of this object=1839060256\r\n```\r\n\r\nFor Test1.do URI, you will get response like below.\r\n\r\n```\r\nTest JSP Page inside WEB-INF folder.\r\nInit Param \"test\" value =null\r\nHashCode of this object=38139054\r\n```\r\n\r\nNotice the init param value in second case is null because it's not defined for the second servlet, also notice the hashcode is different. If you will make further requests, the hashcode value will not change because the requests are processed by spawning a new thread by the container. Did you noticed the use of **config** variable in above JSP example but there is no variable declared, it's because its one of the 9 implicit objects available in JSP page, read more about them at [**JSP Implicit Objects**](\/community\/tutorials\/jsp-implicit-objects \"JSP Implicit Objects with Examples\").\r\n<\/code><\/pre>\n<ol>JSP API\u754c\u9762\u548c\u7c7b<\/ol>\n<pre class=\"post-pre\"><code>All the core JSP interfaces and classes are defined in `javax.servlet.jsp` package. Expression Language API interfaces are classes are part of `javax.servlet.jsp.el` package. JSP Tag Libraries interfaces and classes are defined in `javax.servlet.jsp.tagext` package. Here we will look into interfaces and classes of Core JSP API.\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li>\nJspPage Interface<br \/>\nJspPage interface extends Servlet interface and declares jspInit() and jspDestroy() life cycle methods of the JSP pages.\n<\/li>\n<li>\nHttpJspPage Interface<br \/>\nHttpJspPage interface describes the interaction that a JSP Page Implementation Class must satisfy when using the HTTP protocol. This interface declares the service method of JSP page for HTTP protocol as public void _jspService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException.\n<\/li>\n<li>\nJspWriter abstract Class<br \/>\nSimilar to PrintWriter in servlets with additional facility of buffering support. This is one of the implicit variables in a JSP page with name \u201cout\u201d. This class extends java.io.Writer and container provide their own implementation for this abstract class and use it while translating JSP page to Servlet. We can get it\u2019s object using PageContext.getOut() method. Apache Tomcat concrete class for JspWriter is org.apache.jasper.runtime.JspWriterImpl.\n<\/li>\n<li>\nJspContext abstract Class<br \/>\nJspContext serves as the base class for the PageContext class and abstracts all information that is not specific to servlets. The JspContext provides mechanism to obtain the JspWriter for output, mechanism to work with attributes and API to manage the various scoped namespaces.\n<\/li>\n<li>\nPageContext abstract Class<br \/>\nPageContext extends JspContext to provide useful context information when JSP is used for web applications. A PageContext instance provides access to all the namespaces associated with a JSP page, provides access to several page attributes, as well as a layer above the implementation details. Implicit objects are added to the pageContext automatically.\n<\/li>\n<li>\nJspFactory abstract Class<br \/>\nThe JspFactory is an abstract class that defines a number of factory methods available to a JSP page at runtime for the purposes of creating instances of various interfaces and classes used to support the JSP implementation.\n<\/li>\n<li>\nJspEngineInfo abstract Class<br \/>\nThe JspEngineInfo is an abstract class that provides information on the current JSP engine.\n<\/li>\n<li>\nErrorData final Class<br \/>\nContains information about an error, for error pages.\n<\/li>\n<li>\nJspException Class<br \/>\nA generic exception known to the JSP container, similar to ServletException.If JSP pages throw JspException then errorpage mechanism is used to present error information to user.\n<\/li>\n<li>\nJspTagException Class<br \/>\nException to be used by a Tag Handler to indicate some unrecoverable error.\n<\/li>\n<li>\nSkipPageException Class<br \/>\nException to indicate the calling page must cease evaluation. Thrown by a simple tag handler to indicate that the remainder of the page must not be evaluated. This exception should not be thrown manually in a JSP page.\n<\/li>\n<\/ul>\n<ol>JSP \u6ce8\u91ca<\/ol>\n<pre class=\"post-pre\"><code>Since JSP is built on top of HTML, we can write comments in JSP file like html comments as `&lt;-- This is HTML Comment --&gt;` These comments are sent to the client and we can look it with view source option of browsers. We can put comments in JSP files as: `&lt;%-- This is JSP Comment--%&gt;` This comment is suitable for developers to provide code level comments because these are not sent in the client response.\r\n<\/code><\/pre>\n<ol>JSP \u811a\u672c\u5757<\/ol>\n<pre class=\"post-pre\"><code>Scriptlet tags are the easiest way to put java code in a JSP page. A scriptlet tag starts with `&lt;%` and ends with `%&gt;`. Any code written inside the scriptlet tags go into the `_jspService()` method. For example:\r\n\r\n```\r\n&lt;%\r\nDate d = new Date();\r\nSystem.out.println(\"Current Date=\"+d);\r\n%&gt;\r\n```\r\n<\/code><\/pre>\n<ol>JSP \u8868\u8fbe\u5f0f<\/ol>\n<pre class=\"post-pre\"><code>Since most of the times we print dynamic data in JSP page using _out.print()_ method, there is a shortcut to do this through JSP Expressions. JSP Expression starts with `&lt;%=` and ends with `%&gt;`. `&lt;% out.print(\"Pankaj\"); %&gt;` can be written using JSP Expression as `&lt;%= \"Pankaj\" %&gt;` Notice that anything between `&lt;%= %&gt;` is sent as parameter to `out.print()` method. Also notice that scriptlets can contain multiple java statements and always ends with semicolon (;) but expression doesn't end with semicolon.\r\n<\/code><\/pre>\n<ol>JSP\u6307\u4ee4<\/ol>\n<pre class=\"post-pre\"><code>JSP Directives are used to give special instructions to the container while JSP page is getting translated to servlet source code. JSP directives starts with `&lt;%@` and ends with `%&gt;` For example, in above JSP Example, I am using _page_ directive to to instruct container JSP translator to import the Date class.\r\n<\/code><\/pre>\n<ol>JSP\u58f0\u660e<\/ol>\n<pre class=\"post-pre\"><code>JSP Declarations are used to declare member methods and variables of servlet class. JSP Declarations starts with `&lt;%!` and ends with `%&gt;`. For example we can create an int variable in JSP at class level as `&lt;%! public static int count=0; %&gt;`\r\n<\/code><\/pre>\n<ol>JSP\u5728Tomcat\u4e2d\u8f6c\u6362\u4e86Servlet\u6e90\u7801\u548c\u7c7b\u6587\u4ef6\u7684\u4f4d\u7f6e\u3002<\/ol>\n<pre class=\"post-pre\"><code>Once JSP files are translated to Servlet source code, the source code (.java) and compiled classes both are place in **Tomcat\/work\/Catalina\/localhost\/FirstJSP\/org\/apache\/jsp** directory. If the JSP files are inside other directories of application, the directory structure is maintained. For JSPs inside WEB-INF directory, its source and class files are inside **Tomcat\/work\/Catalina\/localhost\/FirstJSP\/org\/apache\/jsp\/WEB\\_002dINF** directory. Here is the source code generated for above test.jsp page. `test_jsp.java`\r\n\r\n```\r\n\/*\r\n * Generated by the Jasper component of Apache Tomcat\r\n * Version: Apache Tomcat\/7.0.32\r\n * Generated at: 2013-08-21 03:40:59 UTC\r\n * Note: The last modified time of this file was set to\r\n *       the last modified time of the source file after\r\n *       generation to assist with modification tracking.\r\n *\/\r\npackage org.apache.jsp.WEB_002dINF;\r\n\r\nimport javax.servlet.*;\r\nimport javax.servlet.http.*;\r\nimport javax.servlet.jsp.*;\r\n\r\npublic final class test_jsp extends org.apache.jasper.runtime.HttpJspBase\r\n    implements org.apache.jasper.runtime.JspSourceDependent {\r\n\r\n  private static final javax.servlet.jsp.JspFactory _jspxFactory =\r\n          javax.servlet.jsp.JspFactory.getDefaultFactory();\r\n\r\n  private static java.util.Map&lt;java.lang.String,java.lang.Long&gt; _jspx_dependants;\r\n\r\n  private javax.el.ExpressionFactory _el_expressionfactory;\r\n  private org.apache.tomcat.InstanceManager _jsp_instancemanager;\r\n\r\n  public java.util.Map&lt;java.lang.String,java.lang.Long&gt; getDependants() {\r\n    return _jspx_dependants;\r\n  }\r\n\r\n  public void _jspInit() {\r\n    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();\r\n    _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());\r\n  }\r\n\r\n  public void _jspDestroy() {\r\n  }\r\n\r\n  public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)\r\n        throws java.io.IOException, javax.servlet.ServletException {\r\n\r\n    final javax.servlet.jsp.PageContext pageContext;\r\n    javax.servlet.http.HttpSession session = null;\r\n    final javax.servlet.ServletContext application;\r\n    final javax.servlet.ServletConfig config;\r\n    javax.servlet.jsp.JspWriter out = null;\r\n    final java.lang.Object page = this;\r\n    javax.servlet.jsp.JspWriter _jspx_out = null;\r\n    javax.servlet.jsp.PageContext _jspx_page_context = null;\r\n\r\n\r\n    try {\r\n      response.setContentType(\"text\/html; charset=US-ASCII\");\r\n      pageContext = _jspxFactory.getPageContext(this, request, response,\r\n      \t\t\tnull, true, 8192, true);\r\n      _jspx_page_context = pageContext;\r\n      application = pageContext.getServletContext();\r\n      config = pageContext.getServletConfig();\r\n      session = pageContext.getSession();\r\n      out = pageContext.getOut();\r\n      _jspx_out = out;\r\n\r\n      out.write(\"\\n\");\r\n      out.write(\"&lt;!DOCTYPE html PUBLIC \\\"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\\\" \\\"https:\/\/www.w3.org\/TR\/html4\/loose.dtd\\\"&gt;\\n\");\r\n      out.write(\"&lt;html&gt;\\n\");\r\n      out.write(\"&lt;head&gt;\\n\");\r\n      out.write(\"&lt;meta http-equiv=\\\"Content-Type\\\" content=\\\"text\/html; charset=US-ASCII\\\"&gt;\\n\");\r\n      out.write(\"&lt;title&gt;Test JSP&lt;\/title&gt;\\n\");\r\n      out.write(\"&lt;\/head&gt;\\n\");\r\n      out.write(\"&lt;body&gt;\\n\");\r\n      out.write(\"Test JSP Page inside WEB-INF folder.&lt;br&gt;\\n\");\r\n      out.write(\"Init Param \\\"test\\\" value =\");\r\n      out.print(config.getInitParameter(\"test\") );\r\n      out.write(\"&lt;br&gt;\\n\");\r\n      out.write(\"HashCode of this object=\");\r\n      out.print(this.hashCode() );\r\n      out.write(\"\\n\");\r\n      out.write(\"&lt;\/body&gt;\\n\");\r\n      out.write(\"&lt;\/html&gt;\");\r\n    } catch (java.lang.Throwable t) {\r\n      if (!(t instanceof javax.servlet.jsp.SkipPageException)){\r\n        out = _jspx_out;\r\n        if (out != null &amp;&amp; out.getBufferSize() != 0)\r\n          try { out.clearBuffer(); } catch (java.io.IOException e) {}\r\n        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);\r\n        else throw new ServletException(t);\r\n      }\r\n    } finally {\r\n      _jspxFactory.releasePageContext(_jspx_page_context);\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nNotice following points in above servlet code;\r\n-   The package of class starts with org.apache.jsp and if JSPs are inside other folders, it includes directory hierarchy too. Usually we dont care about it.\r\n-   The generates servlet class is final and can't be extended.\r\n-   It extends `org.apache.jasper.runtime.HttpJspBase` that is similar to HttpServlet except that it's internal to Tomcat JSP Translator implementation. HttpJspBase extends HttpServlet and implements HttpJspPage interface.\r\n-   Notice the local variables at the start of \\_jspService() method implementation, they are automatically added by JSP translator and available for use in service methods, i.e in scriptlets.As a java programmer, sometimes it helps to look into the generated source for debugging purposes.\r\n<\/code><\/pre>\n<ol>JSP\u521d\u59cb\u53c2\u6570<\/ol>\n<pre class=\"post-pre\"><code>We can define init parameters for the JSP page as shown in above example and we can retrieve them in JSP using **config** implicit object, we will look into implicit objects in JSP in more detail in future posts.\r\n<\/code><\/pre>\n<ol>\u91cd\u5199JSP\u7684init()\u65b9\u6cd5<\/ol>\n<pre class=\"post-pre\"><code>We can override JSP init method for creating resources to be used by JSP service() method using JSP Declaration tags, we can override jspInit() and jspDestroy() or any other methods also. However we should never override \\_jspService() method because anything we write in JSP goes into service method.\r\n<\/code><\/pre>\n<ol>JSP\u4e2d\u7684\u5c5e\u6027<\/ol>\n<pre class=\"post-pre\"><code>Apart from standard servlet attributes with request, session and context scope, in JSP we have another scope for attributes, i.e Page Scope that we can get from pageContext object. We will look it's importance in custom tags tutorial. For normal JSP programming, we don't need to worry about page scope.\r\n<\/code><\/pre>\n<p>\u8fd9\u5c31\u662f\u7ed9\u521d\u5b66\u8005\u51c6\u5907\u7684JSP\u793a\u4f8b\u6559\u7a0b\u7684\u5168\u90e8\u5185\u5bb9\u4e86\u3002\u5e0c\u671b\u5b83\u80fd\u5e2e\u52a9\u4f60\u7406\u89e3JSP\u7684\u57fa\u672c\u6982\u5ff5\u5e76\u5e2e\u52a9\u4f60\u5165\u95e8\u3002\u6211\u4eec\u5c06\u5728\u672a\u6765\u7684\u5e16\u5b50\u4e2d\u4e86\u89e3\u5176\u4ed6JSP\u7684\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b22\u8fce\u6765\u5230\u9762\u5411\u521d\u5b66\u8005\u7684JSP\u793a\u4f8b\u6559\u7a0b\u3002\u5728\u6700\u8fd1\u51e0\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4ecb\u7ecd\u4e86\u5f88\u591a\u5173\u4e8eJava Servlet\u7684\u5185\u5bb9\uff0c\u5e76\u4e14\u5f97\u5230 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1130,2089,2090,1160],"class_list":["post-778","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-java-web","tag-javaserver-pages","tag-jsp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JSP\u5165\u95e8\u6559\u7a0b\uff1a\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60JavaServer Pages\u7f16\u7a0b\u793a\u4f8b - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u672cJSP\u5165\u95e8\u6559\u7a0b\u4e13\u4e3a\u521d\u5b66\u8005\u8bbe\u8ba1\uff0c\u901a\u8fc7\u8be6\u7ec6\u7684\u793a\u4f8b\u4ee3\u7801\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u638c\u63e1JavaServer Pages\u6280\u672f\u3002\u4ece\u57fa\u7840\u6982\u5ff5\u5230\u5b9e\u9645\u5e94\u7528\uff0c\u5168\u9762\u8bb2\u89e3JSP\u5f00\u53d1\u6280\u5de7\uff0c\u8ba9\u60a8\u8f7b\u677e\u5165\u95e8Java Web\u5f00\u53d1\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u521d\u5b66\u8005\u7684jsp\u793a\u4f8b\u6559\u7a0b\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JSP\u5165\u95e8\u6559\u7a0b\uff1a\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60JavaServer Pages\u7f16\u7a0b\u793a\u4f8b\" \/>\n<meta property=\"og:description\" content=\"\u672cJSP\u5165\u95e8\u6559\u7a0b\u4e13\u4e3a\u521d\u5b66\u8005\u8bbe\u8ba1\uff0c\u901a\u8fc7\u8be6\u7ec6\u7684\u793a\u4f8b\u4ee3\u7801\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u638c\u63e1JavaServer Pages\u6280\u672f\u3002\u4ece\u57fa\u7840\u6982\u5ff5\u5230\u5b9e\u9645\u5e94\u7528\uff0c\u5168\u9762\u8bb2\u89e3JSP\u5f00\u53d1\u6280\u5de7\uff0c\u8ba9\u60a8\u8f7b\u677e\u5165\u95e8Java Web\u5f00\u53d1\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u521d\u5b66\u8005\u7684jsp\u793a\u4f8b\u6559\u7a0b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-25T11:41:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-02T23:27:05+00:00\" \/>\n<meta name=\"author\" content=\"\u65b0, \u97f5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u65b0, \u97f5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\",\"name\":\"JSP\u5165\u95e8\u6559\u7a0b\uff1a\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60JavaServer Pages\u7f16\u7a0b\u793a\u4f8b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-08-25T11:41:52+00:00\",\"dateModified\":\"2025-08-02T23:27:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\"},\"description\":\"\u672cJSP\u5165\u95e8\u6559\u7a0b\u4e13\u4e3a\u521d\u5b66\u8005\u8bbe\u8ba1\uff0c\u901a\u8fc7\u8be6\u7ec6\u7684\u793a\u4f8b\u4ee3\u7801\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u638c\u63e1JavaServer Pages\u6280\u672f\u3002\u4ece\u57fa\u7840\u6982\u5ff5\u5230\u5b9e\u9645\u5e94\u7528\uff0c\u5168\u9762\u8bb2\u89e3JSP\u5f00\u53d1\u6280\u5de7\uff0c\u8ba9\u60a8\u8f7b\u677e\u5165\u95e8Java Web\u5f00\u53d1\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JSP\u5165\u95e8\u6559\u7a0b\uff1a\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60JavaServer Pages\u7f16\u7a0b\u793a\u4f8b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9\",\"name\":\"\u65b0, \u97f5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g\",\"caption\":\"\u65b0, \u97f5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JSP\u5165\u95e8\u6559\u7a0b\uff1a\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60JavaServer Pages\u7f16\u7a0b\u793a\u4f8b - Blog - Silicon Cloud","description":"\u672cJSP\u5165\u95e8\u6559\u7a0b\u4e13\u4e3a\u521d\u5b66\u8005\u8bbe\u8ba1\uff0c\u901a\u8fc7\u8be6\u7ec6\u7684\u793a\u4f8b\u4ee3\u7801\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u638c\u63e1JavaServer Pages\u6280\u672f\u3002\u4ece\u57fa\u7840\u6982\u5ff5\u5230\u5b9e\u9645\u5e94\u7528\uff0c\u5168\u9762\u8bb2\u89e3JSP\u5f00\u53d1\u6280\u5de7\uff0c\u8ba9\u60a8\u8f7b\u677e\u5165\u95e8Java Web\u5f00\u53d1\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u521d\u5b66\u8005\u7684jsp\u793a\u4f8b\u6559\u7a0b\/","og_locale":"zh_CN","og_type":"article","og_title":"JSP\u5165\u95e8\u6559\u7a0b\uff1a\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60JavaServer Pages\u7f16\u7a0b\u793a\u4f8b","og_description":"\u672cJSP\u5165\u95e8\u6559\u7a0b\u4e13\u4e3a\u521d\u5b66\u8005\u8bbe\u8ba1\uff0c\u901a\u8fc7\u8be6\u7ec6\u7684\u793a\u4f8b\u4ee3\u7801\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u638c\u63e1JavaServer Pages\u6280\u672f\u3002\u4ece\u57fa\u7840\u6982\u5ff5\u5230\u5b9e\u9645\u5e94\u7528\uff0c\u5168\u9762\u8bb2\u89e3JSP\u5f00\u53d1\u6280\u5de7\uff0c\u8ba9\u60a8\u8f7b\u677e\u5165\u95e8Java Web\u5f00\u53d1\u3002","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u521d\u5b66\u8005\u7684jsp\u793a\u4f8b\u6559\u7a0b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-08-25T11:41:52+00:00","article_modified_time":"2025-08-02T23:27:05+00:00","author":"\u65b0, \u97f5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u65b0, \u97f5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","name":"JSP\u5165\u95e8\u6559\u7a0b\uff1a\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60JavaServer Pages\u7f16\u7a0b\u793a\u4f8b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-08-25T11:41:52+00:00","dateModified":"2025-08-02T23:27:05+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9"},"description":"\u672cJSP\u5165\u95e8\u6559\u7a0b\u4e13\u4e3a\u521d\u5b66\u8005\u8bbe\u8ba1\uff0c\u901a\u8fc7\u8be6\u7ec6\u7684\u793a\u4f8b\u4ee3\u7801\u548c\u6b65\u9aa4\u8bf4\u660e\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u638c\u63e1JavaServer Pages\u6280\u672f\u3002\u4ece\u57fa\u7840\u6982\u5ff5\u5230\u5b9e\u9645\u5e94\u7528\uff0c\u5168\u9762\u8bb2\u89e3JSP\u5f00\u53d1\u6280\u5de7\uff0c\u8ba9\u60a8\u8f7b\u677e\u5165\u95e8Java Web\u5f00\u53d1\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"JSP\u5165\u95e8\u6559\u7a0b\uff1a\u4ece\u96f6\u5f00\u59cb\u5b66\u4e60JavaServer Pages\u7f16\u7a0b\u793a\u4f8b"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/4ba4019495123db3038fd0809e6959c9","name":"\u65b0, \u97f5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d484b6c6e4ae82e8a9efea989e1d2af46d9b6ef128101e63b18f559fca0ae627?s=96&d=mm&r=g","caption":"\u65b0, \u97f5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunxin\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%88%9d%e5%ad%a6%e8%80%85%e7%9a%84jsp%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=778"}],"version-history":[{"count":3,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/778\/revisions"}],"predecessor-version":[{"id":110667,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/778\/revisions\/110667"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}