{"id":333,"date":"2023-06-04T02:06:40","date_gmt":"2022-12-08T02:42:15","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/index.php\/2023\/11\/30\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/"},"modified":"2025-08-01T23:37:49","modified_gmt":"2025-08-01T15:37:49","slug":"primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","title":{"rendered":"2023\u5e74PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u5b8c\u6574\u6559\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\u793a\u4f8b"},"content":{"rendered":"<p>\u8fd9\u662f\u6587\u7ae0\u300aPrimefaces\u7684\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u793a\u4f8b\u6559\u7a0b\u300b\u7684\u7b2c1\u90e8\u5206\uff08\u51716\u90e8\u5206\uff09\u3002<\/p>\n<p>\u5185\u5bb9\u7247\u6bb5: \u4eca\u5929\u6211\u4eec\u5c06\u4ecb\u7ecdPrimefaces\u7684FileUpload\u7ec4\u4ef6\u3002HTML\u63d0\u4f9b\u4e86\u6587\u4ef6\u8f93\u5165\u6807\u7b7e\u6765\u9009\u62e9\u6587\u4ef6\uff0c\u4f46\u8981\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u6211\u4eec\u9700\u8981\u66f4\u591a\u7684\u64cd\u4f5c\u3002Primefaces\u901a\u8fc7\u63d0\u4f9b\u73b0\u6210\u7684FileUpload\u7ec4\u4ef6\uff0c\u51cf\u8f7b\u4e86\u8fd9\u4e2a\u8d1f\u62c5\uff0c\u5e2e\u52a9\u60a8\u521b\u5efa\u7f8e\u89c2\u7684UI\uff0c\u5e76\u4e3a\u6587\u4ef6\u4e0a\u4f20\u63d0\u4f9b\u540e\u53f0\u652f\u6301\u3002<\/p>\n<h2>Primefaces\u6587\u4ef6\u4e0a\u4f20<\/h2>\n<p>\u6211\u4eec\u5c06\u4e86\u89e3Primefaces FileUpload\u7ec4\u4ef6\u7684\u529f\u80fd\uff0c\u60a8\u53ef\u4ee5\u5728\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u3002\u8fd9\u4e2a\u6559\u7a0b\u5047\u8bbe\u60a8\u5177\u6709Primeface\u7684\u57fa\u672c\u77e5\u8bc6\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u8bf7\u5148\u770bPrimefaces\u793a\u4f8b\u3002<\/p>\n<h3>Primefaces \u6587\u4ef6\u4e0a\u4f20\u57fa\u672c\u4fe1\u606f<\/h3>\n<div>\n<div class=\"post-table\">\n<table>\n<thead>\n<tr>\n<th>\u6807\u7b7e<\/th>\n<th>fileUpload<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u7ec4\u4ef6\u7c7b<\/td>\n<td>org.primefaces.component.fileupload.FileUpload<\/td>\n<\/tr>\n<tr>\n<td>\u7ec4\u4ef6\u7c7b\u578b<\/td>\n<td>org.primefaces.component.FileUpload<\/td>\n<\/tr>\n<tr>\n<td>\u7ec4\u4ef6\u65cf<\/td>\n<td>org.primefaces.component<\/td>\n<\/tr>\n<tr>\n<td>\u6e32\u67d3\u5668\u7c7b\u578b<\/td>\n<td>org.primefaces.component.FileUploadRenderer<\/td>\n<\/tr>\n<tr>\n<td>\u6e32\u67d3\u5668\u7c7b<\/td>\n<td>org.primefaces.component.fileupload.FileUploadRenderer<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>Primefaces\u6587\u4ef6\u4e0a\u4f20\u5c5e\u6027<\/h3>\n<div>\n<div class=\"post-table\">\n<table>\n<thead>\n<tr>\n<th>\u540d\u79f0<\/th>\n<th>\u9ed8\u8ba4\u503c<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>id<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u7ec4\u4ef6\u7684\u552f\u4e00\u6807\u8bc6\u7b26\u3002<\/td>\n<\/tr>\n<tr>\n<td>rendered<\/td>\n<td>true<\/td>\n<td>boolean<\/td>\n<td>\u6307\u5b9a\u7ec4\u4ef6\u662f\u5426\u6e32\u67d3\u7684\u5e03\u5c14\u503c\uff0c\u5f53\u8bbe\u7f6e\u4e3afalse\u65f6\u7ec4\u4ef6\u5c06\u4e0d\u4f1a\u88ab\u6e32\u67d3\u3002<\/td>\n<\/tr>\n<tr>\n<td>binding<\/td>\n<td>null<\/td>\n<td>Object<\/td>\n<td>\u6620\u5c04\u5230\u540e\u7aefBean\u4e2d\u670d\u52a1\u5668\u7aefUIComponent\u5b9e\u4f8b\u7684EL\u8868\u8fbe\u5f0f\u3002<\/td>\n<\/tr>\n<tr>\n<td>value<\/td>\n<td>null<\/td>\n<td>Object<\/td>\n<td>\u7ec4\u4ef6\u7684\u503c\uff0c\u53ef\u4ee5\u662fEL\u8868\u8fbe\u5f0f\u6216\u6587\u672c\u5b57\u9762\u91cf\u3002<\/td>\n<\/tr>\n<tr>\n<td>converter<\/td>\n<td>null<\/td>\n<td>Converter\/String<\/td>\n<td>\u4e3a\u7ec4\u4ef6\u5b9a\u4e49\u8f6c\u6362\u5668\u7684EL\u8868\u8fbe\u5f0f\u6216\u6587\u672c\u5b57\u9762\u91cf\u3002\u5f53\u5b83\u662fEL\u8868\u8fbe\u5f0f\u65f6\uff0c\u5b83\u88ab\u89e3\u6790\u4e3a\u8f6c\u6362\u5668\u5b9e\u4f8b\u3002\u5982\u679c\u662f\u9759\u6001\u6587\u672c\uff0c\u5219\u5fc5\u987b\u5f15\u7528\u8f6c\u6362\u5668ID\u3002<\/td>\n<\/tr>\n<tr>\n<td>immediate<\/td>\n<td>false<\/td>\n<td>Boolean<\/td>\n<td>\u5f53\u8bbe\u7f6e\u4e3atrue\u65f6\uff0c\u5bf9\u6b64\u7ec4\u4ef6\u5728\u5e94\u7528\u8bf7\u6c42\u503c\u9636\u6bb5\u6267\u884c\u9a8c\u8bc1\u903b\u8f91\u3002<\/td>\n<\/tr>\n<tr>\n<td>required<\/td>\n<td>false<\/td>\n<td>Boolean<\/td>\n<td>\u5c06\u7ec4\u4ef6\u6807\u8bb0\u4e3a\u5fc5\u586b\u3002<\/td>\n<\/tr>\n<tr>\n<td>validator<\/td>\n<td>null<\/td>\n<td>MethodExpr<\/td>\n<td>\u5f15\u7528\u9a8c\u8bc1\u8f93\u5165\u65b9\u6cd5\u7684\u8868\u8fbe\u5f0f\u3002<\/td>\n<\/tr>\n<tr>\n<td>valueChangeListener<\/td>\n<td>null<\/td>\n<td>MethodExpr<\/td>\n<td>\u5f15\u7528\u5904\u7406valueChangeEvent\u65b9\u6cd5\u7684\u8868\u8fbe\u5f0f\u3002<\/td>\n<\/tr>\n<tr>\n<td>requiredMessage<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u5fc5\u586b\u5b57\u6bb5\u9a8c\u8bc1\u5931\u8d25\u65f6\u663e\u793a\u7684\u6d88\u606f\u3002<\/td>\n<\/tr>\n<tr>\n<td>converterMessage<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u8f6c\u6362\u5931\u8d25\u65f6\u663e\u793a\u7684\u6d88\u606f\u3002<\/td>\n<\/tr>\n<tr>\n<td>validatorMessage<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u9a8c\u8bc1\u5931\u8d25\u65f6\u663e\u793a\u7684\u6d88\u606f\u3002<\/td>\n<\/tr>\n<tr>\n<td>widgetVar<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u5ba2\u6237\u7aef\u5c0f\u90e8\u4ef6\u7684\u540d\u79f0\u3002<\/td>\n<\/tr>\n<tr>\n<td>update<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u6587\u4ef6\u4e0a\u4f20\u5b8c\u6210\u540e\u8981\u66f4\u65b0\u7684\u7ec4\u4ef6\u3002<\/td>\n<\/tr>\n<tr>\n<td>process<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u5728\u6587\u4ef6\u4e0a\u4f20\u8bf7\u6c42\u4e2d\u8981\u5904\u7406\u7684\u7ec4\u4ef6\u3002<\/td>\n<\/tr>\n<tr>\n<td>fileUploadListener<\/td>\n<td>null<\/td>\n<td>MethodExpr<\/td>\n<td>\u6587\u4ef6\u4e0a\u4f20\u65f6\u8c03\u7528\u7684\u65b9\u6cd5\u3002<\/td>\n<\/tr>\n<tr>\n<td>multiple<\/td>\n<td>false<\/td>\n<td>Boolean<\/td>\n<td>\u5141\u8bb8\u4ece\u672c\u673a\u9009\u62e9\u591a\u4e2a\u6587\u4ef6\u4e0a\u4f20\u3002<\/td>\n<\/tr>\n<tr>\n<td>auto<\/td>\n<td>false<\/td>\n<td>Boolean<\/td>\n<td>\u5f53\u8bbe\u7f6e\u4e3atrue\u65f6\uff0c\u9009\u62e9\u6587\u4ef6\u4f1a\u9690\u5f0f\u542f\u52a8\u4e0a\u4f20\u8fc7\u7a0b\u3002<\/td>\n<\/tr>\n<tr>\n<td>label<\/td>\n<td>Choose<\/td>\n<td>String<\/td>\n<td>\u6d4f\u89c8\u6309\u94ae\u7684\u6807\u7b7e\u3002<\/td>\n<\/tr>\n<tr>\n<td>allowTypes<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u63a5\u53d7\u6587\u4ef6\u7c7b\u578b\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u3002<\/td>\n<\/tr>\n<tr>\n<td>sizeLimit<\/td>\n<td>null<\/td>\n<td>Integer<\/td>\n<td>\u5355\u4e2a\u6587\u4ef6\u5927\u5c0f\u9650\u5236\uff08\u5b57\u8282\uff09\u3002<\/td>\n<\/tr>\n<tr>\n<td>fileLimit<\/td>\n<td>null<\/td>\n<td>Integer<\/td>\n<td>\u5141\u8bb8\u4e0a\u4f20\u7684\u6700\u5927\u6587\u4ef6\u6570\u91cf\u3002<\/td>\n<\/tr>\n<tr>\n<td>style<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u7ec4\u4ef6\u7684\u5185\u8054\u6837\u5f0f\u3002<\/td>\n<\/tr>\n<tr>\n<td>styleClass<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u7ec4\u4ef6\u7684\u6837\u5f0f\u7c7b\u3002<\/td>\n<\/tr>\n<tr>\n<td>mode<\/td>\n<td>advanced<\/td>\n<td>String<\/td>\n<td>\u6587\u4ef6\u4e0a\u4f20\u7684\u6a21\u5f0f\uff0c\u53ef\u4ee5\u662fsimple\u6216advanced\u3002<\/td>\n<\/tr>\n<tr>\n<td>uploadLabel<\/td>\n<td>Upload<\/td>\n<td>String<\/td>\n<td>\u4e0a\u4f20\u6309\u94ae\u7684\u6807\u7b7e\u3002<\/td>\n<\/tr>\n<tr>\n<td>cancelLabel<\/td>\n<td>Cancel<\/td>\n<td>String<\/td>\n<td>\u53d6\u6d88\u6309\u94ae\u7684\u6807\u7b7e\u3002<\/td>\n<\/tr>\n<tr>\n<td>invalidSizeMessage<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u5927\u5c0f\u9650\u5236\u8d85\u8fc7\u65f6\u663e\u793a\u7684\u6d88\u606f\u3002<\/td>\n<\/tr>\n<tr>\n<td>invalidFileMessage<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u6587\u4ef6\u4e0d\u88ab\u63a5\u53d7\u65f6\u663e\u793a\u7684\u6d88\u606f\u3002<\/td>\n<\/tr>\n<tr>\n<td>fileLimitMessage<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u6587\u4ef6\u9650\u5236\u8d85\u8fc7\u65f6\u663e\u793a\u7684\u6d88\u606f\u3002<\/td>\n<\/tr>\n<tr>\n<td>dragDropSupport<\/td>\n<td>true<\/td>\n<td>Boolean<\/td>\n<td>\u6307\u5b9a\u4ece\u6587\u4ef6\u7cfb\u7edf\u4e2d\u57fa\u4e8e\u62d6\u653e\u7684\u6587\u4ef6\u9009\u62e9\uff0c\u9ed8\u8ba4\u4e3atrue\uff0c\u4ec5\u5728\u652f\u6301\u7684\u6d4f\u89c8\u5668\u4e0a\u5de5\u4f5c\u3002<\/td>\n<\/tr>\n<tr>\n<td>onstart<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u4e0a\u4f20\u5f00\u59cb\u65f6\u6267\u884c\u7684\u5ba2\u6237\u7aef\u56de\u8c03\u3002<\/td>\n<\/tr>\n<tr>\n<td>onerror<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u6587\u4ef6\u4e0a\u4f20\u8bf7\u6c42\u5931\u8d25\u65f6\u6267\u884c\u7684\u56de\u8c03\u3002<\/td>\n<\/tr>\n<tr>\n<td>oncomplete<\/td>\n<td>null<\/td>\n<td>String<\/td>\n<td>\u4e0a\u4f20\u7ed3\u675f\u65f6\u6267\u884c\u7684\u5ba2\u6237\u7aef\u56de\u8c03\u3002<\/td>\n<\/tr>\n<tr>\n<td>disabled<\/td>\n<td>false<\/td>\n<td>Boolean<\/td>\n<td>\u8bbe\u7f6e\u4e3atrue\u65f6\u7981\u7528\u7ec4\u4ef6\u3002<\/td>\n<\/tr>\n<tr>\n<td>messageTemplate<\/td>\n<td>{name} {size}<\/td>\n<td>String<\/td>\n<td>\u663e\u793a\u6587\u4ef6\u9a8c\u8bc1\u9519\u8bef\u65f6\u4f7f\u7528\u7684\u6d88\u606f\u6a21\u677f\u3002<\/td>\n<\/tr>\n<tr>\n<td>previewWidth<\/td>\n<td>80<\/td>\n<td>Integer<\/td>\n<td>\u56fe\u50cf\u9884\u89c8\u7684\u5bbd\u5ea6\uff08\u50cf\u7d20\uff09\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>Primefaces\u6587\u4ef6\u4e0a\u4f20\u793a\u4f8b<\/h3>\n<p>\u8981\u4f7f\u7528FileUpload\u7ec4\u4ef6\uff0c\u60a8\u5fc5\u987b\u901a\u8fc7\u6dfb\u52a0primefaces.UPLOADER\u7684\u7f51\u7edc\u90e8\u7f72\u53c2\u6570\u6765\u63d0\u4f9bFileUpload\u5f15\u64ce\uff0c\u8be5\u53c2\u6570\u53ef\u4ee5\u63a5\u53d7\u4ee5\u4e0b\u503c\uff1aauto\u3001native\u6216commons\u3002\u5728web.xml\u4e2d\u7684\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n<pre class=\"post-pre\"><code>&lt;context-param&gt;\r\n  &lt;param-name&gt;primefaces.UPLOADER&lt;\/param-name&gt;\r\n  &lt;param-value&gt;auto|native|commons&lt;\/param-value&gt;\r\n&lt;\/context-param&gt;\r\n<\/code><\/pre>\n<h4>auto\u6a21\u5f0f<\/h4>\n<p>\u8fd9\u662f\u9ed8\u8ba4\u6a21\u5f0f\uff0cPrimefaces\u4f1a\u901a\u8fc7\u68c0\u67e5\u8fd0\u884c\u73af\u5883\u6765\u5c1d\u8bd5\u68c0\u6d4b\u6700\u4f73\u65b9\u6cd5\u3002\u5982\u679cJSF\u8fd0\u884c\u65f6\u7248\u672c\u81f3\u5c11\u4e3a2.2\uff0c\u5219\u9009\u62e9\u539f\u751f\u4e0a\u4f20\u65b9\u5f0f\uff0c\u5426\u5219\u9009\u62e9commons\u3002<\/p>\n<h4>native\u6a21\u5f0f<\/h4>\n<p>\u4f7f\u7528servlet 3.x Part API\u6765\u4e0a\u4f20\u6587\u4ef6\u3002\u5982\u679cJSF\u8fd0\u884c\u65f6\u7248\u672c\u5c0f\u4e8e2.2\uff0c\u5219\u4f1a\u629b\u51fa\u5f02\u5e38\u3002<\/p>\n<h4>commons\u6a21\u5f0f<\/h4>\n<p>\u9009\u62e9commons fileUpload\u5e93\uff0c\u9700\u8981\u5728\u90e8\u7f72\u63cf\u8ff0\u7b26\u4e2d\u8fdb\u884c\u4ee5\u4e0b\u8fc7\u6ee4\u5668\u914d\u7f6e\u3002<\/p>\n<h4>web.xml \u6587\u4ef6\u914d\u7f6e<\/h4>\n<pre class=\"post-pre\"><code>&lt;filter&gt;\r\n &lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;\/filter-name&gt;\r\n &lt;filter-class&gt;\r\n  org.primefaces.webapp.filter.FileUploadFilter\r\n &lt;\/filter-class&gt;\r\n&lt;\/filter&gt;\r\n&lt;filter-mapping&gt;\r\n &lt;filter-name&gt;PrimeFaces FileUpload Filter&lt;\/filter-name&gt;\r\n &lt;servlet-name&gt;Faces Servlet&lt;\/servlet-name&gt;\r\n&lt;\/filter-mapping&gt;\r\n<\/code><\/pre>\n<p>\u8bf7\u6ce8\u610f\uff0cservlet-name \u5e94\u8be5\u4e0e JSF servlet \u7684\u914d\u7f6e\u540d\u79f0\u5339\u914d\uff0c\u4e5f\u5c31\u662f Faces Servlet\u3002\u6216\u8005\uff0c\u4f60\u4e5f\u53ef\u4ee5\u57fa\u4e8e URL-pattern \u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n<h3>Primefaces \u7b80\u5355\u6587\u4ef6\u4e0a\u4f20<\/h3>\n<p>\u7b80\u5355\u6587\u4ef6\u4e0a\u4f20\u6a21\u5f0f\u9002\u7528\u4e8e\u65e7\u7248\u6d4f\u89c8\u5668\uff0c\u5176\u4e2d\u6587\u4ef6\u8f93\u5165\u7684\u503c\u5e94\u8be5\u662f\u4e00\u4e2a\u5df2\u4e0a\u4f20\u6587\u4ef6\u5b9e\u4f8b\u3002\u7b80\u5355\u4e0a\u4f20\u4e0d\u652f\u6301Ajax\u4e0a\u4f20\u3002\u8bf7\u67e5\u770b\u4e0b\u9762\u6240\u9700\u7684\u6587\u4ef6\u4ee5\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u6587\u4ef6\u4e0a\u4f20\u793a\u4f8b\u3002index.xhtml\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;html xmlns=\"https:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"https:\/\/java.sun.com\/jsf\/facelets\"\r\n\txmlns:h=\"https:\/\/java.sun.com\/jsf\/html\"\r\n\txmlns:f=\"https:\/\/java.sun.com\/jsf\/core\"\r\n\txmlns:p=\"https:\/\/primefaces.org\/ui\"&gt;\r\n\t&lt;h:head&gt;\r\n\t\t&lt;title&gt;Journaldev Tutorial&lt;\/title&gt;\r\n\t&lt;\/h:head&gt;\r\n\t&lt;h:body&gt;\r\n\t\t&lt;h:form enctype=\"multipart\/form-data\"&gt;\r\n\t\t\t\t&lt;p:fileUpload value=\"#{fileUploadManagedBean.file}\"  mode=\"simple\"&gt;&lt;\/p:fileUpload&gt;\r\n\t\t\t\t&lt;p:separator\/&gt;\r\n\t\t\t\t&lt;h:commandButton value=\"Dummy Action\" action=\"#{fileUploadManagedBean.dummyAction}\"&gt;&lt;\/h:commandButton&gt;\r\n\t\t&lt;\/h:form&gt;\r\n\t&lt;\/h:body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>package com.Olivia.prime.faces.beans;\r\n\r\nimport javax.faces.bean.ManagedBean;\r\nimport javax.faces.bean.SessionScoped;\r\n\r\nimport org.primefaces.model.UploadedFile;\r\n\r\n@ManagedBean\r\n@SessionScoped\r\npublic class FileUploadManagedBean {\r\n\tUploadedFile file;\r\n\r\n\tpublic UploadedFile getFile() {\r\n\t\treturn file;\r\n\t}\r\n\r\n\tpublic void setFile(UploadedFile file) {\r\n\t\tthis.file = file;\r\n\t}\r\n\r\n\tpublic String dummyAction(){\r\n\t\tSystem.out.println(\"Uploaded File Name Is :: \"+file.getFileName()+\" :: Uploaded File Size :: \"+file.getSize());\r\n\t\treturn \"\";\r\n\t}\r\n}\r\n<\/code><\/pre>\n<p>web.xml \u7f51\u7edc\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;web-app xmlns:xsi=\"https:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n\txmlns=\"https:\/\/java.sun.com\/xml\/ns\/javaee\" xmlns:web=\"https:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_2_5.xsd\"\r\n\txsi:schemaLocation=\"https:\/\/java.sun.com\/xml\/ns\/javaee\r\n\thttps:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_2_5.xsd\"\r\n\tid=\"WebApp_ID\" version=\"2.5\" metadata-complete=\"true\"&gt;\r\n\t&lt;servlet&gt;\r\n\t\t&lt;servlet-name&gt;Faces Servlet&lt;\/servlet-name&gt;\r\n\t\t&lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;\/servlet-class&gt;\r\n\t\t&lt;load-on-startup&gt;1&lt;\/load-on-startup&gt;\r\n\t&lt;\/servlet&gt;\r\n\t&lt;servlet-mapping&gt;\r\n\t\t&lt;servlet-name&gt;Faces Servlet&lt;\/servlet-name&gt;\r\n\t\t&lt;url-pattern&gt;\/faces\/*&lt;\/url-pattern&gt;\r\n\t&lt;\/servlet-mapping&gt;\r\n\t&lt;servlet-mapping&gt;\r\n\t\t&lt;servlet-name&gt;Faces Servlet&lt;\/servlet-name&gt;\r\n\t\t&lt;url-pattern&gt;*.xhtml&lt;\/url-pattern&gt;\r\n\t&lt;\/servlet-mapping&gt;\r\n\t&lt;context-param&gt;\r\n\t\t&lt;description&gt;State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2&lt;\/description&gt;\r\n\t\t&lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;\/param-name&gt;\r\n\t\t&lt;param-value&gt;client&lt;\/param-value&gt;\r\n\t&lt;\/context-param&gt;\r\n\t&lt;context-param&gt;\r\n\t\t&lt;param-name&gt;primefaces.UPLOADER&lt;\/param-name&gt;\r\n\t\t&lt;param-value&gt;auto&lt;\/param-value&gt;\r\n\t&lt;\/context-param&gt;\r\n\t&lt;listener&gt;\r\n\t\t&lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;\/listener-class&gt;\r\n\t&lt;\/listener&gt;\r\n&lt;\/web-app&gt;\r\n<\/code><\/pre>\n<p>pom.xml -&gt; \u9879\u76ee\u5bf9\u8c61\u6a21\u578b\u6587\u4ef6<\/p>\n<pre class=\"post-pre\"><code>&lt;project xmlns=\"https:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"https:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n  xsi:schemaLocation=\"https:\/\/maven.apache.org\/POM\/4.0.0 https:\/\/maven.apache.org\/maven-v4_0_0.xsd\"&gt;\r\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n  &lt;groupId&gt;com.Olivia&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;Primefaces-FileUpload-Sample&lt;\/artifactId&gt;\r\n  &lt;packaging&gt;war&lt;\/packaging&gt;\r\n  &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n  &lt;name&gt;Primefaces-FileUpload-Sample Maven Webapp&lt;\/name&gt;\r\n   &lt;url&gt;https:\/\/maven.apache.org&lt;\/url&gt;\r\n\t&lt;repositories&gt;\r\n\t\t&lt;repository&gt;\r\n\t\t\t&lt;id&gt;prime-repo&lt;\/id&gt;\r\n\t\t\t&lt;name&gt;PrimeFaces Maven Repository&lt;\/name&gt;\r\n\t\t\t&lt;url&gt;https:\/\/repository.primefaces.org&lt;\/url&gt;\r\n\t\t\t&lt;layout&gt;default&lt;\/layout&gt;\r\n\t\t&lt;\/repository&gt;\r\n\t&lt;\/repositories&gt;\r\n\t&lt;dependencies&gt;\r\n\t\t&lt;!-- Servlet --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;javax.servlet&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;servlet-api&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;2.5&lt;\/version&gt;\r\n\t\t\t&lt;scope&gt;provided&lt;\/scope&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- Faces Implementation --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;com.sun.faces&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;jsf-impl&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;2.2.4&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- Faces Library --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;com.sun.faces&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;jsf-api&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;2.2.4&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- Primefaces Version 5 --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.primefaces&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;primefaces&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;5.0&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- JSP Library --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;javax.servlet.jsp&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;javax.servlet.jsp-api&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;2.3.1&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- JSTL Library --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;javax.servlet&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;jstl&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;1.1.2&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t&lt;\/dependencies&gt;\r\n&lt;\/project&gt;\r\n<\/code><\/pre>\n<p>\u7b80\u800c\u8a00\u4e4b\uff1a<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u4f7f\u7528\u7684Primefaces FileUpload\u5f15\u64ce\u662f\u81ea\u52a8\u7684\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>fileUpload\u7ec4\u4ef6\u7684value\u5c5e\u6027\u4e0eUploadedFile\u5b9e\u4f8b\u5173\u8054\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u4f7f\u7528fileUpload\u9700\u8981\u5728\u8868\u5355\u4e2d\u5305\u542bfileUpload\u7ec4\u4ef6\uff0c\u5176enctype\u4e3amultipart\/form-data\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u63d0\u4f9b\u7684\u865a\u62df\u64cd\u4f5c\u7528\u4e8e\u6253\u5370\u4e0a\u4f20\u6587\u4ef6\u7684\u540d\u79f0\u548c\u5927\u5c0f\u3002<\/ol>\n<p>\u5728\u54ea\u91cc\uff0cdemo\u7684\u7ed3\u679c\u5c06\u662f\uff1a\u7b80\u5355\u8f93\u5165\u6309\u94ae\u5df2\u6e32\u67d3\u5230\u60a8\u7684\u6d4f\u89c8\u5668\u4e2d\u3002\u4e00\u65e6\u60a8\u70b9\u51fb\u4e86&#8221;\u865a\u62df\u64cd\u4f5c&#8221;\uff0c\u4e00\u4e2a\u865a\u62df\u52a8\u4f5c\u65b9\u6cd5\u5c06\u6267\u884c\uff0c\u5e76\u4e14\u4e0a\u4f20\u6587\u4ef6\u7684\u4fe1\u606f\u5c06\u88ab\u6253\u5370\u5230\u60a8\u7684\u63a7\u5236\u53f0\u4e2d\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<h3>Primefaces \u9ad8\u7ea7\u6587\u4ef6\u4e0a\u4f20<\/p>\n<h3>PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u9ad8\u7ea7\u89c6\u56fe\u6559\u7a0b<\/h3>\n<p>FileUpload\u7ec4\u4ef6\u63d0\u4f9b\u4e86\u7b80\u5355\u89c6\u56fe\u548c\u9ad8\u7ea7\u89c6\u56fe\u4e24\u79cd\u6a21\u5f0f\u3002\u9009\u62e9\u9ad8\u7ea7\u89c6\u56fe\u540e\uff0c\u6587\u4ef6\u4e0a\u4f20\u5c06\u901a\u8fc7FileUploadListener\u8fdb\u884c\u5904\u7406\u3002\u5f53\u6587\u4ef6\u4e0a\u4f20\u5b8c\u6210\u65f6\uff0c\u7cfb\u7edf\u4f1a\u5c06FileUploadEvent\u4f5c\u4e3a\u53c2\u6570\u4f20\u9012\u7ed9\u76d1\u542c\u5668\uff0c\u4ece\u800c\u89e6\u53d1\u76f8\u5e94\u7684\u5904\u7406\u903b\u8f91\u3002\u8bf7\u67e5\u770b\u4e0b\u65b9\u6240\u9700\u7684\u6587\u4ef6\uff0c\u4ee5\u5e2e\u52a9\u60a8\u4f7f\u7528\u9ad8\u7ea7\u6a21\u5f0f\u3002<\/p>\n<h4>index.xhtml<\/h4>\n<pre class=\"post-pre\"><code>&lt;html xmlns=\"https:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"https:\/\/java.sun.com\/jsf\/facelets\"\r\n\txmlns:h=\"https:\/\/java.sun.com\/jsf\/html\"\r\n\txmlns:f=\"https:\/\/java.sun.com\/jsf\/core\"\r\n\txmlns:p=\"https:\/\/primefaces.org\/ui\"&gt;\r\n\t&lt;h:head&gt;\r\n\t\t&lt;title&gt;Journaldev\u6559\u7a0b&lt;\/title&gt;\r\n\t&lt;\/h:head&gt;\r\n\t&lt;h:body&gt;\r\n\t\t&lt;h:form enctype=\"multipart\/form-data\" style=\"width:500px\"&gt;\r\n\t\t\t\t&lt;p:fileUpload value=\"#{fileUploadManagedBean.file}\" mode=\"advanced\"\r\n\t\t\t\t\t\t\tfileUploadListener=\"#{fileUploadManagedBean.fileUploadListener}\"&gt;&lt;\/p:fileUpload&gt;\r\n\t\t&lt;\/h:form&gt;\r\n\t&lt;\/h:body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<h4>FileUploadManagedBean.java<\/h4>\n<pre class=\"post-pre\"><code>package com.Olivia.prime.faces.beans;\r\n\r\nimport javax.faces.bean.ManagedBean;\r\nimport javax.faces.bean.SessionScoped;\r\n\r\nimport org.primefaces.event.FileUploadEvent;\r\nimport org.primefaces.model.UploadedFile;\r\n\r\n@ManagedBean\r\n@SessionScoped\r\npublic class FileUploadManagedBean {\r\n\tUploadedFile file;\r\n\r\n\tpublic UploadedFile getFile() {\r\n\t\treturn file;\r\n\t}\r\n\r\n\tpublic void setFile(UploadedFile file) {\r\n\t\tthis.file = file;\r\n\t}\r\n\r\n\tpublic void fileUploadListener(FileUploadEvent e){\r\n\t\t\/\/ \u4eceFileUploadEvent\u83b7\u53d6\u4e0a\u4f20\u7684\u6587\u4ef6\r\n\t\tthis.file = e.getFile();\r\n\t\t\/\/ \u8f93\u51fa\u6587\u4ef6\u4fe1\u606f\r\n\t\tSystem.out.println(\"\u4e0a\u4f20\u7684\u6587\u4ef6\u540d\u662f\uff1a\"+file.getFileName()+\" :: \u6587\u4ef6\u5927\u5c0f\u662f\uff1a\"+file.getSize());\r\n\t}\r\n}\r\n<\/code><\/pre>\n<h4>\u5173\u952e\u70b9\u603b\u7ed3<\/h4>\n<ul>\n<li>\u7531\u4e8eweb.xml\u548cpom.xml\u6587\u4ef6\u6ca1\u6709\u53d1\u751f\u53d8\u5316\uff0c\u56e0\u6b64\u5728\u672c\u90e8\u5206\u4e2d\u672a\u63d0\u53ca\u3002<\/li>\n<li>\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u7684value\u5c5e\u6027\u4e0eUploadedFile\u5b9e\u4f8b\u76f8\u5173\u8054\uff0c\u540c\u65f6\u7ec4\u4ef6\u4e5f\u88abFileUploadListener\u76d1\u542c\u3002<\/li>\n<li>FileUploadListener\u63a5\u6536FileUploadEvent\u4f5c\u4e3a\u53c2\u6570\u3002<\/li>\n<li>\u4e00\u65e6\u70b9\u51fb&#8221;\u4e0a\u4f20&#8221;\u6309\u94ae\uff0cFileUploadListener\u5c06\u88ab\u6267\u884c\uff0c\u540c\u65f6\u521b\u5efa\u5e76\u4f20\u9012\u4e00\u4e2aFileUploadEvent\u3002<\/li>\n<\/ul>\n<p>\u5728\u6f14\u793a\u7ed3\u679c\u4e2d\uff0c\u4e0a\u4f20\u7ec4\u4ef6\u4f1a\u663e\u793a\u4e00\u4e2a\u65b0\u7684\u89c6\u56fe\uff0c\u5305\u542b\u4e24\u4e2a\u989d\u5916\u7684\u6309\u94ae\uff1a\u4e00\u4e2a\u7528\u4e8e\u4e0a\u4f20\uff0c\u53e6\u4e00\u4e2a\u7528\u4e8e\u53d6\u6d88\u3002\u5728\u6267\u884c\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<ul>\n<li>\u4e0a\u4f20\u7684\u6587\u4ef6\u901a\u8fc7FileUploadEvent\u4f20\u9012\uff0c\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528\u4e8b\u4ef6\u5bf9\u8c61\u7684e.getFile()\u65b9\u6cd5\u8bbf\u95ee\uff0c\u8be5\u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2aUploadedFile\u5b9e\u4f8b\u3002<\/li>\n<li>\u5982\u679c\u70b9\u51fb&#8221;\u53d6\u6d88&#8221;\u800c\u4e0d\u662f&#8221;\u4e0a\u4f20&#8221;\uff0c\u4e0a\u4f20\u8fc7\u7a0b\u5c06\u5b8c\u5168\u7ec8\u6b62\u3002\u53d6\u6d88\u4e0a\u4f20\u4f1a\u963b\u6b62\u76d1\u542c\u5668\u88ab\u8c03\u7528\u3002<\/li>\n<\/ul>\n<h3>PrimeFaces\u591a\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd<\/h3>\n<p>\u4f7f\u7528FileUpload\u7ec4\u4ef6\u4e0a\u4f20\u591a\u4e2a\u6587\u4ef6\u662f\u53ef\u884c\u7684\uff0c\u7528\u6237\u53ef\u4ee5\u4ece\u6d4f\u89c8\u5668\u5bf9\u8bdd\u6846\u4e2d\u9009\u62e9\u591a\u4e2a\u6587\u4ef6\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u65e7\u7248\u672c\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u591a\u6b21\u4e0a\u4f20\u529f\u80fd\u3002\u5c06multiple\u5c5e\u6027\u8bbe\u7f6e\u4e3atrue\uff0c\u53ef\u4ee5\u542f\u7528\u591a\u6587\u4ef6\u9009\u62e9\u529f\u80fd\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u591a\u6587\u4ef6\u9009\u62e9\u5e76\u4e0d\u610f\u5473\u7740\u6240\u6709\u6587\u4ef6\u5c06\u5728\u4e00\u4e2a\u8bf7\u6c42\u4e2d\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u662f\u4f1a\u9010\u4e2a\u53d1\u9001\u3002\u8bf7\u770b\u4e0b\u9762\u6240\u9700\u7684\u66f4\u6539\uff0c\u4ee5\u5b9e\u73b0\u591a\u6587\u4ef6\u9009\u62e9\u529f\u80fd\uff1a<\/p>\n<h4>index.xhtml<\/h4>\n<pre class=\"post-pre\"><code>&lt;html xmlns=\"https:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"https:\/\/java.sun.com\/jsf\/facelets\"\r\n\txmlns:h=\"https:\/\/java.sun.com\/jsf\/html\"\r\n\txmlns:f=\"https:\/\/java.sun.com\/jsf\/core\"\r\n\txmlns:p=\"https:\/\/primefaces.org\/ui\"&gt;\r\n\t&lt;h:head&gt;\r\n\t\t&lt;title&gt;Journaldev\u6559\u7a0b&lt;\/title&gt;\r\n\t&lt;\/h:head&gt;\r\n\t&lt;h:body&gt;\r\n\t\t&lt;h:form enctype=\"multipart\/form-data\" style=\"width:500px\"&gt;\r\n\t\t\t\t&lt;p:fileUpload value=\"#{fileUploadManagedBean.file}\" mode=\"advanced\" multiple=\"true\"\r\n\t\t\t\t\t\t\tfileUploadListener=\"#{fileUploadManagedBean.fileUploadListener}\"&gt;&lt;\/p:fileUpload&gt;\r\n\t\t&lt;\/h:form&gt;\r\n\t&lt;\/h:body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<h4>FileUploadManagedBean.java<\/h4>\n<pre class=\"post-pre\"><code>package com.Olivia.prime.faces.beans;\r\n\r\nimport javax.faces.bean.ManagedBean;\r\nimport javax.faces.bean.SessionScoped;\r\n\r\nimport org.primefaces.event.FileUploadEvent;\r\nimport org.primefaces.model.UploadedFile;\r\n\r\n@ManagedBean\r\n@SessionScoped\r\npublic class FileUploadManagedBean {\r\n\tUploadedFile file;\r\n\r\n\tpublic UploadedFile getFile() {\r\n\t\treturn file;\r\n\t}\r\n\r\n\tpublic void setFile(UploadedFile file) {\r\n\t\tthis.file = file;\r\n\t}\r\n\r\n\tpublic void fileUploadListener(FileUploadEvent e){\r\n\t\t\/\/ \u4eceFileUploadEvent\u83b7\u53d6\u4e0a\u4f20\u7684\u6587\u4ef6\r\n\t\tthis.file = e.getFile();\r\n\t\t\/\/ \u8f93\u51fa\u6587\u4ef6\u4fe1\u606f\r\n\t\tSystem.out.println(\"\u4e0a\u4f20\u7684\u6587\u4ef6\u540d\u662f\uff1a\"+file.getFileName()+\" :: \u6587\u4ef6\u5927\u5c0f\u662f\uff1a\"+file.getSize());\r\n\t}\r\n}\r\n<\/code><\/pre>\n<p>\u5728\u5e94\u7528\u7a0b\u5e8f\u6267\u884c\u7ed3\u679c\u4e2d\uff0c\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<ul>\n<li>\u70b9\u51fb&#8221;\u53d6\u6d88&#8221;\u6309\u94ae\u5c06\u53d6\u6d88\u4e0a\u4f20\u64cd\u4f5c\u5e76\u7ec8\u6b62\u6240\u6709\u6587\u4ef6\u7684\u4e0a\u4f20\u8fc7\u7a0b\u3002<\/li>\n<li>\u70b9\u51fb\u6bcf\u4e2a\u5c06\u8981\u4e0a\u4f20\u7684\u6587\u4ef6\u65c1\u8fb9\u7684X\u56fe\u6807\uff0c\u5c06\u4ec5\u53d6\u6d88\u76f8\u5e94\u6587\u4ef6\u7684\u4e0a\u4f20\u3002<\/li>\n<li>\u4e00\u65e6\u70b9\u51fb\u4e86\u4e0a\u4f20\u64cd\u4f5c\uff0c\u76d1\u542c\u5668\u5c06\u6839\u636e\u5df2\u52a0\u8f7d\u6587\u4ef6\u7684\u6570\u91cf\u88ab\u8c03\u7528\u76f8\u5e94\u6b21\u6570\u3002<\/li>\n<\/ul>\n<h3>PrimeFaces\u81ea\u52a8\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd<\/h3>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6587\u4ef6\u4e0a\u4f20\u9700\u8981\u7528\u6237\u624b\u52a8\u89e6\u53d1\u4e0a\u4f20\u8fc7\u7a0b\uff0c\u4f46\u60a8\u53ef\u4ee5\u901a\u8fc7\u5c06auto\u5c5e\u6027\u8bbe\u7f6e\u4e3atrue\u6765\u66f4\u6539\u8fd9\u79cd\u884c\u4e3a\u3002\u542f\u7528\u81ea\u52a8\u4e0a\u4f20\u540e\uff0c\u5728\u9009\u62e9\u5bf9\u8bdd\u6846\u4e2d\u7684\u6587\u4ef6\u540e\uff0c\u4e0a\u4f20\u8fc7\u7a0b\u5c06\u7acb\u5373\u5f00\u59cb\u3002\u8bf7\u770b\u4e0b\u9762\u6240\u9700\u7684\u66f4\u6539\uff0c\u4ee5\u5b9e\u73b0\u81ea\u52a8\u4e0a\u4f20\u529f\u80fd\uff1a<\/p>\n<h4>index.xhtml<\/h4>\n<pre class=\"post-pre\"><code>&lt;html xmlns=\"https:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"https:\/\/java.sun.com\/jsf\/facelets\"\r\n\txmlns:h=\"https:\/\/java.sun.com\/jsf\/html\"\r\n\txmlns:f=\"https:\/\/java.sun.com\/jsf\/core\"\r\n\txmlns:p=\"https:\/\/primefaces.org\/ui\"&gt;\r\n\t&lt;h:head&gt;\r\n\t\t&lt;title&gt;Journaldev\u6559\u7a0b&lt;\/title&gt;\r\n\t&lt;\/h:head&gt;\r\n\t&lt;h:body&gt;\r\n\t\t&lt;h:form enctype=\"multipart\/form-data\" style=\"width:500px\"&gt;\r\n\t\t\t\t&lt;p:fileUpload value=\"#{fileUploadManagedBean.file}\" mode=\"advanced\" multiple=\"true\" auto=\"true\"\r\n\t\t\t\t\t\t\tfileUploadListener=\"#{fileUploadManagedBean.fileUploadListener}\"&gt;&lt;\/p:fileUpload&gt;\r\n\t\t&lt;\/h:form&gt;\r\n\t&lt;\/h:body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<p>\u4e00\u65e6\u60a8\u70b9\u51fb\u4e86&#8221;\u6253\u5f00&#8221;\u6309\u94ae\uff0c\u5e94\u7528\u7a0b\u5e8f\u7684\u6267\u884c\u7ed3\u679c\u5982\u4e0b\u6240\u793a\uff1a\u4e0a\u4f20\u8fc7\u7a0b\u7acb\u5373\u5f00\u59cb\u3002<\/p>\n<h3>PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u5c40\u90e8\u9875\u9762\u66f4\u65b0<\/h3>\n<p>\u6587\u4ef6\u4e0a\u4f20\u8fc7\u7a0b\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Primefaces PPR\uff08\u5c40\u90e8\u9875\u9762\u6e32\u67d3\uff09\u6765\u66f4\u65b0\u9875\u9762\u4e0a\u7684\u4efb\u4f55\u7ec4\u4ef6\u3002FileUpload\u7684update\u5c5e\u6027\u5c31\u662f\u4e3a\u6b64\u76ee\u7684\u800c\u8bbe\u8ba1\u7684\u3002\u4e0b\u9762\u7684\u4f8b\u5b50\u5c55\u793a\u4e86\u5728\u6587\u4ef6\u4e0a\u4f20\u540e\u4f7f\u7528growl\u7ec4\u4ef6\u663e\u793a&#8221;\u6587\u4ef6\u4e0a\u4f20\u6210\u529f&#8221;\u7684\u6d88\u606f\u3002\u5728\u540e\u7eed\u7684messages\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u8ba8\u8bbagrowl\u7ec4\u4ef6\u3002\u4e0b\u9762\u7684\u4ee3\u7801\u7247\u6bb5\u5c06\u5e2e\u52a9\u60a8\u5728\u6587\u4ef6\u4e0a\u4f20\u540e\u663e\u793a\u4e00\u6761\u6d88\u606f\u3002index.xhtml<\/p>\n<pre class=\"post-pre\"><code>&lt;html xmlns=\"https:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"https:\/\/java.sun.com\/jsf\/facelets\"\r\n\txmlns:h=\"https:\/\/java.sun.com\/jsf\/html\"\r\n\txmlns:f=\"https:\/\/java.sun.com\/jsf\/core\"\r\n\txmlns:p=\"https:\/\/primefaces.org\/ui\"&gt;\r\n\t&lt;h:head&gt;\r\n\t\t&lt;title&gt;Journaldev Tutorial&lt;\/title&gt;\r\n\t&lt;\/h:head&gt;\r\n\t&lt;h:body&gt;\r\n\t\t&lt;h:form enctype=\"multipart\/form-data\" style=\"width:500px\"&gt;\r\n\t\t\t\t&lt;p:growl id=\"msg\"&gt;&lt;\/p:growl&gt;\r\n\t\t\t\t&lt;p:fileUpload value=\"#{fileUploadManagedBean.file}\" mode=\"advanced\"\r\n\t\t\t\t\t\t\tfileUploadListener=\"#{fileUploadManagedBean.fileUploadListener}\" update=\"msg\"&gt;&lt;\/p:fileUpload&gt;\r\n\t\t&lt;\/h:form&gt;\r\n\t&lt;\/h:body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>package com.Olivia.prime.faces.beans;\r\n\r\nimport javax.faces.application.FacesMessage;\r\nimport javax.faces.bean.ManagedBean;\r\nimport javax.faces.bean.SessionScoped;\r\nimport javax.faces.context.FacesContext;\r\n\r\nimport org.primefaces.event.FileUploadEvent;\r\nimport org.primefaces.model.UploadedFile;\r\n\r\n@ManagedBean\r\n@SessionScoped\r\npublic class FileUploadManagedBean {\r\n\tUploadedFile file;\r\n\r\n\tpublic UploadedFile getFile() {\r\n\t\treturn file;\r\n\t}\r\n\r\n\tpublic void setFile(UploadedFile file) {\r\n\t\tthis.file = file;\r\n\t}\r\n\r\n\tpublic void fileUploadListener(FileUploadEvent e){\r\n\t\t\/\/ \u83b7\u53d6\u4e0a\u4f20\u7684\u6587\u4ef6\r\n\t\tthis.file = e.getFile();\r\n\t\t\/\/ \u8f93\u51fa\u6587\u4ef6\u4fe1\u606f\r\n\t\tSystem.out.println(\"\u4e0a\u4f20\u7684\u6587\u4ef6\u540d\u662f :: \"+file.getFileName()+\" :: \u6587\u4ef6\u5927\u5c0f :: \"+file.getSize());\r\n\t\t\/\/ \u6dfb\u52a0\u6d88\u606f\r\n\t\tFacesContext.getCurrentInstance().addMessage(null,new FacesMessage(\"\u6587\u4ef6\u4e0a\u4f20\u6210\u529f\"));\r\n\t}\r\n}\r\n<\/code><\/pre>\n<p>\u5728\u6267\u884c\u7684\u7ed3\u679c\u4e2d\uff0c\u60c5\u51b5\u5982\u4e0b\uff1a\u5df2\u7ecf\u5c06\u4e00\u6761\u6d88\u606f\u6dfb\u52a0\u5230FacesContext\u4e2d\uff0c\u5e76\u4e14FileUpload\u7ec4\u4ef6\u5b9a\u4e49\u4e86update\u5c5e\u6027\uff0c\u5c06\u901a\u8fc7Ajax\u673a\u5236\u6e32\u67d3\u8be5\u6d88\u606f\u3002\u5173\u4e8eAjax\u884c\u4e3a\u5c06\u5728\u53e6\u4e00\u7bc7\u6559\u7a0b\u4e2d\u8ba8\u8bba\u3002<\/p>\n<h3>\u6587\u4ef6\u4e0a\u4f20\u8fc7\u6ee4\u5668<\/h3>\n<p>\u6587\u4ef6\u4e0a\u4f20\u8fc7\u6ee4\u5668\u53ef\u4ee5\u9650\u5236\u7528\u6237\u53ea\u9009\u62e9\u60a8\u914d\u7f6e\u7684\u7279\u5b9a\u6587\u4ef6\u7c7b\u578b\uff0c\u4e0b\u9762\u7684\u793a\u4f8b\u6f14\u793a\u4e86\u5982\u4f55\u8bbe\u7f6e\u53ea\u63a5\u53d7\u56fe\u50cf\u6587\u4ef6\uff08index.xhtml\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;html xmlns=\"https:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"https:\/\/java.sun.com\/jsf\/facelets\"\r\n\txmlns:h=\"https:\/\/java.sun.com\/jsf\/html\"\r\n\txmlns:f=\"https:\/\/java.sun.com\/jsf\/core\"\r\n\txmlns:p=\"https:\/\/primefaces.org\/ui\"&gt;\r\n\t&lt;h:head&gt;\r\n\t\t&lt;title&gt;Journaldev Tutorial&lt;\/title&gt;\r\n\t&lt;\/h:head&gt;\r\n\t&lt;h:body&gt;\r\n\t\t&lt;h:form enctype=\"multipart\/form-data\" style=\"width:500px\"&gt;\r\n\t\t\t\t&lt;p:growl id=\"msg\"&gt;&lt;\/p:growl&gt;\r\n\t\t\t\t&lt;p:fileUpload value=\"#{fileUploadManagedBean.file}\" mode=\"advanced\" allowTypes=\"\/(\\.|\\\/)(gif|jpe?g|png)$\/\"\r\n\t\t\t\t\t\t\tfileUploadListener=\"#{fileUploadManagedBean.fileUploadListener}\" update=\"msg\"&gt;&lt;\/p:fileUpload&gt;\r\n\t\t&lt;\/h:form&gt;\r\n\t&lt;\/h:body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<p>\u6267\u884c\u7684\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n<h3>Primefaces \u6587\u4ef6\u4e0a\u4f20\u5927\u5c0f\u9650\u5236\u4e0e\u6587\u4ef6\u6570\u91cf\u9650\u5236<\/h3>\n<p>\u6709\u65f6\u5019\uff0c\u60a8\u9700\u8981\u9650\u5236\u4e0a\u4f20\u6587\u4ef6\u7684\u5927\u5c0f\u6216\u4e0a\u4f20\u7684\u6587\u4ef6\u6570\u91cf\u3002\u5728Primefaces\u7684FileUpload\u7ec4\u4ef6\u4e2d\uff0c\u5b9e\u73b0\u8fd9\u4e9b\u9650\u5236\u975e\u5e38\u7b80\u5355\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728FileUpload\u7ec4\u4ef6\u4e0a\u5206\u522b\u8bbe\u7f6esizeLimit\u548cfileLimit\u5c5e\u6027\u6765\u5b9e\u73b0\u8fd9\u4e9b\u9650\u5236\u3002\u4ee5\u4e0b\u662f\u9650\u5236\u7528\u6237\u4e0a\u4f20\u7684\u4ee3\u7801\u7247\u6bb5\uff1aindex.xhtml<\/p>\n<pre class=\"post-pre\"><code>&lt;html xmlns=\"https:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"https:\/\/java.sun.com\/jsf\/facelets\"\r\n\txmlns:h=\"https:\/\/java.sun.com\/jsf\/html\"\r\n\txmlns:f=\"https:\/\/java.sun.com\/jsf\/core\"\r\n\txmlns:p=\"https:\/\/primefaces.org\/ui\"&gt;\r\n\t&lt;h:head&gt;\r\n\t\t&lt;title&gt;Journaldev Tutorial&lt;\/title&gt;\r\n\t&lt;\/h:head&gt;\r\n\t&lt;h:body&gt;\r\n\t\t&lt;h:form enctype=\"multipart\/form-data\" style=\"width:500px\"&gt;\r\n\t\t\t\t&lt;p:growl id=\"msg\"&gt;&lt;\/p:growl&gt;\r\n\t\t\t\t&lt;p:fileUpload value=\"#{fileUploadManagedBean.file}\" mode=\"advanced\" multiple=\"true\" fileLimit=\"3\" sizeLimit=\"2048\"\r\n\t\t\t\t\t\t\tfileUploadListener=\"#{fileUploadManagedBean.fileUploadListener}\" update=\"msg\"&gt;&lt;\/p:fileUpload&gt;\r\n\t\t&lt;\/h:form&gt;\r\n\t&lt;\/h:body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<p>\u5f53\u60a8\u5c1d\u8bd5\u4e0a\u4f20\u8d85\u8fc7\u4e09\u4e2a\u6587\u4ef6\u6216\u6587\u4ef6\u5927\u5c0f\u8d85\u8fc7\u9650\u5236\u65f6\uff0c\u4f1a\u663e\u793a\u4ee5\u4e0b\u9519\u8bef\u6d88\u606f\uff1a<\/p>\n<h3>Primefaces\u6587\u4ef6\u4e0a\u4f20\u9a8c\u8bc1\u6d88\u606f<\/h3>\n<p>Primefaces\u63d0\u4f9b\u4e86invalidFileMessage\u3001invalidSizeMessage\u548cfileLimitMessage\u9009\u9879\uff0c\u7528\u4e8e\u5411\u7528\u6237\u663e\u793a\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u6d88\u606f\u3002\u60a8\u53ef\u4ee5\u6839\u636e\u9700\u8981\u4e3a\u8fd9\u4e9b\u9a8c\u8bc1\u8bbe\u7f6e\u4efb\u4f55\u6d88\u606f\u3002\u8bf7\u67e5\u770b\u4e0b\u9762\u63d0\u4f9b\u7684\u793a\u4f8b\uff0cindex.xhtml\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;html xmlns=\"https:\/\/www.w3.org\/1999\/xhtml\"\r\n\txmlns:ui=\"https:\/\/java.sun.com\/jsf\/facelets\"\r\n\txmlns:h=\"https:\/\/java.sun.com\/jsf\/html\"\r\n\txmlns:f=\"https:\/\/java.sun.com\/jsf\/core\"\r\n\txmlns:p=\"https:\/\/primefaces.org\/ui\"&gt;\r\n\t&lt;h:head&gt;\r\n\t\t&lt;title&gt;Journaldev Tutorial&lt;\/title&gt;\r\n\t&lt;\/h:head&gt;\r\n\t&lt;h:body&gt;\r\n\t\t&lt;h:form enctype=\"multipart\/form-data\" style=\"width:500px\"&gt;\r\n\t\t\t\t&lt;p:growl id=\"msg\"&gt;&lt;\/p:growl&gt;\r\n\t\t\t\t&lt;p:fileUpload value=\"#{fileUploadManagedBean.file}\"\r\n\t\t\t\t\t\tinvalidSizeMessage=\"JournalDev: \u6587\u4ef6\u5927\u5c0f\u65e0\u6548\"\r\n\t\t\t\t\t\tinvalidFileMessage=\"JournalDev: \u6587\u4ef6\u7c7b\u578b\u65e0\u6548\"\r\n\t\t\t\t\t\tfileLimitMessage=\"JournalDev: \u6587\u4ef6\u6570\u91cf\u8d85\u51fa\u9650\u5236\"\r\n\t\t\t\t\t\tmode=\"advanced\" multiple=\"true\" fileLimit=\"3\" sizeLimit=\"2048\"\r\n\t\t\t\t\t\tallowTypes=\"\/(\\.|\\\/)(gif|jpe?g|png)$\/\"\r\n\t\t\t\t\t\tfileUploadListener=\"#{fileUploadManagedBean.fileUploadListener}\"\r\n\t\t\t\t\t\tupdate=\"msg\"&gt;&lt;\/p:fileUpload&gt;\r\n\t\t&lt;\/h:form&gt;\r\n\t&lt;\/h:body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<p>\u6d88\u606f\u663e\u793a\u6548\u679c\u5982\u4e0b\uff1a\u60a8\u4f1a\u6ce8\u610f\u5230\u6d88\u606f\u5185\u5bb9\u5df2\u7ecf\u66f4\u6539\uff0c\u5e76\u663e\u793a\u4e86\u4e0d\u540c\u7684\u6587\u672c\u503c\u3002\u5982\u679c\u60a8\u6ce8\u610f\u5230\u53d7\u7ba1bean\u4ee3\u7801\uff0c\u6211\u4eec\u6ca1\u6709\u5bf9\u6587\u4ef6\u8fdb\u884c\u4efb\u4f55\u64cd\u4f5c\u3002\u7136\u800c\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u573a\u666f\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528UploadedFile\u7684getInputstream()\u65b9\u6cd5\u83b7\u53d6\u6587\u4ef6\u6570\u636e\uff0c\u5e76\u5c06\u5176\u4fdd\u5b58\u5230\u670d\u52a1\u5668\u6216\u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<h3>Primefaces\u6587\u4ef6\u4e0a\u4f20\u603b\u7ed3<\/h3>\n<p>\u672c\u6559\u7a0b\u65e8\u5728\u4e3a\u60a8\u63d0\u4f9b\u6709\u5173\u4f7f\u7528<strong>PrimeFaces\u7684FileUpload\u7ec4\u4ef6<\/strong>\u7684\u5168\u9762\u8be6\u7ec6\u8bf4\u660e\u3002FileUpload\u7ec4\u4ef6\u914d\u5907\u4e86\u8bb8\u591a\u529f\u80fd\uff0c\u53ef\u4ee5\u8ba9\u60a8\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u903b\u8f91\u800c\u4e0d\u662f\u5c1d\u8bd5\u5b9e\u73b0\u7c7b\u4f3c\u529f\u80fd\u3002\u60a8\u53ef\u4ee5\u4ece\u4e0b\u9762\u7684\u94fe\u63a5\u4e0b\u8f7d\u793a\u4f8b\u9879\u76ee\uff0c\u5e76\u901a\u8fc7\u63a2\u7d22\u5176\u4ed6<strong>\u6587\u4ef6\u4e0a\u4f20\u5c5e\u6027<\/strong>\u6765\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<p><a href=\"#\">\u4e0b\u8f7dPrimeFaces\u6587\u4ef6\u4e0a\u4f20\u9879\u76ee<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u662f\u6587\u7ae0\u300aPrimefaces\u7684\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u793a\u4f8b\u6559\u7a0b\u300b\u7684\u7b2c1\u90e8\u5206\uff08\u51716\u90e8\u5206\uff09\u3002 \u5185\u5bb9\u7247\u6bb5: \u4eca\u5929\u6211\u4eec\u5c06\u4ecb\u7ecdPr [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1130,1129,866,1131,1109],"class_list":["post-333","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-java-web","tag-jsf","tag-primefaces","tag-web","tag-1109"],"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>2023\u5e74PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u5b8c\u6574\u6559\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\u793a\u4f8b - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecd\u4e86PrimeFaces\u6846\u67b6\u4e2d\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u6218\u6280\u5de7\u3002\u4ece\u57fa\u7840\u914d\u7f6e\u5230\u9ad8\u7ea7\u529f\u80fd\uff0c\u5e2e\u52a9Java\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u89e3\u51b3\u5b9e\u9645\u5f00\u53d1\u4e2d\u7684\u6587\u4ef6\u5904\u7406\u9700\u6c42\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\/primefaces\u7684\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\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=\"2023\u5e74PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u5b8c\u6574\u6559\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\u793a\u4f8b\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecd\u4e86PrimeFaces\u6846\u67b6\u4e2d\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u6218\u6280\u5de7\u3002\u4ece\u57fa\u7840\u914d\u7f6e\u5230\u9ad8\u7ea7\u529f\u80fd\uff0c\u5e2e\u52a9Java\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u89e3\u51b3\u5b9e\u9645\u5f00\u53d1\u4e2d\u7684\u6587\u4ef6\u5904\u7406\u9700\u6c42\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/primefaces\u7684\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u793a\u4f8b\u6559\u7a0b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-08T02:42:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-01T15:37:49+00:00\" \/>\n<meta name=\"author\" content=\"\u97f5, \u79d1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u97f5, \u79d1\" \/>\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\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\",\"name\":\"2023\u5e74PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u5b8c\u6574\u6559\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\u793a\u4f8b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-12-08T02:42:15+00:00\",\"dateModified\":\"2025-08-01T15:37:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e\"},\"description\":\"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecd\u4e86PrimeFaces\u6846\u67b6\u4e2d\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u6218\u6280\u5de7\u3002\u4ece\u57fa\u7840\u914d\u7f6e\u5230\u9ad8\u7ea7\u529f\u80fd\uff0c\u5e2e\u52a9Java\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u89e3\u51b3\u5b9e\u9645\u5f00\u53d1\u4e2d\u7684\u6587\u4ef6\u5904\u7406\u9700\u6c42\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%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\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%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\":\"2023\u5e74PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u5b8c\u6574\u6559\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\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\/6530331a63adef3b3443a1fab53a0e6e\",\"name\":\"\u97f5, \u79d1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g\",\"caption\":\"\u97f5, \u79d1\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunke\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%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":"2023\u5e74PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u5b8c\u6574\u6559\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\u793a\u4f8b - Blog - Silicon Cloud","description":"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecd\u4e86PrimeFaces\u6846\u67b6\u4e2d\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u6218\u6280\u5de7\u3002\u4ece\u57fa\u7840\u914d\u7f6e\u5230\u9ad8\u7ea7\u529f\u80fd\uff0c\u5e2e\u52a9Java\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u89e3\u51b3\u5b9e\u9645\u5f00\u53d1\u4e2d\u7684\u6587\u4ef6\u5904\u7406\u9700\u6c42\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\/primefaces\u7684\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u793a\u4f8b\u6559\u7a0b\/","og_locale":"zh_CN","og_type":"article","og_title":"2023\u5e74PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u5b8c\u6574\u6559\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\u793a\u4f8b","og_description":"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecd\u4e86PrimeFaces\u6846\u67b6\u4e2d\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u6218\u6280\u5de7\u3002\u4ece\u57fa\u7840\u914d\u7f6e\u5230\u9ad8\u7ea7\u529f\u80fd\uff0c\u5e2e\u52a9Java\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u89e3\u51b3\u5b9e\u9645\u5f00\u53d1\u4e2d\u7684\u6587\u4ef6\u5904\u7406\u9700\u6c42\u3002","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/primefaces\u7684\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u793a\u4f8b\u6559\u7a0b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-12-08T02:42:15+00:00","article_modified_time":"2025-08-01T15:37:49+00:00","author":"\u97f5, \u79d1","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u97f5, \u79d1","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","name":"2023\u5e74PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u5b8c\u6574\u6559\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\u793a\u4f8b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-12-08T02:42:15+00:00","dateModified":"2025-08-01T15:37:49+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e"},"description":"\u672c\u6559\u7a0b\u8be6\u7ec6\u4ecb\u7ecd\u4e86PrimeFaces\u6846\u67b6\u4e2d\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u6218\u6280\u5de7\u3002\u4ece\u57fa\u7840\u914d\u7f6e\u5230\u9ad8\u7ea7\u529f\u80fd\uff0c\u5e2e\u52a9Java\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u89e3\u51b3\u5b9e\u9645\u5f00\u53d1\u4e2d\u7684\u6587\u4ef6\u5904\u7406\u9700\u6c42\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%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\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%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":"2023\u5e74PrimeFaces\u6587\u4ef6\u4e0a\u4f20\u7ec4\u4ef6\u5b8c\u6574\u6559\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\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\/6530331a63adef3b3443a1fab53a0e6e","name":"\u97f5, \u79d1","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g","caption":"\u97f5, \u79d1"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunke\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/primefaces%e7%9a%84%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%84%e4%bb%b6%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\/333","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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=333"}],"version-history":[{"count":4,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/333\/revisions"}],"predecessor-version":[{"id":109846,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/333\/revisions\/109846"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}