我在其中定义了一个参数web.xml
,uploadDirectory
我试图从其中一个中获取ManagedBean
。下面是片段web.xml
——
<!-- Primefaces file upload -->
<!-- thresholdSize specifies the maximum file size in bytes to keep uploaded
files in memory. If it exceeds this limit, it’ll be temporarily written to
disk. -->
<!-- uploadDirectory is the folder where to keep temporary files that exceed
thresholdSize. -->
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>51200</param-value>
</init-param>
<init-param>
<param-name>uploadDirectory</param-name>
<param-value>/opt/upload/</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
下面是片段ManagedBean
——
@ManagedBean
@ViewScoped
public class ProjectInfo implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final String destination = FacesContext.getCurrentInstance()
.getExternalContext().getInitParameter("uploadDirectory");
为什么我越来越null
像destination
?