0
I have a project JSF
and would like to return the project path in a String
. This path has to take the folder webapp
as root. How I do ?
0
I have a project JSF
and would like to return the project path in a String
. This path has to take the folder webapp
as root. How I do ?
1
To get the project path, use:
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
String diretorio = ec.getRealPath("/");
This "directory" string will leave you at the root of your project. With this, you just have to manipulate the string to go to the desired directory.
A replace
, for example, would do exactly as desired.
Browser other questions tagged jsf
You are not signed in. Login or sign up in order to post.