I have defined a parameter inside web.xml
as uploadDirectory
, which I am trying to get from one of ManagedBean
. Below is the snippet of 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>
Below is the snippet of ManagedBean
-
@ManagedBean
@ViewScoped
public class ProjectInfo implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final String destination = FacesContext.getCurrentInstance()
.getExternalContext().getInitParameter("uploadDirectory");
Why I am getting null
as destination
?