留言板

File path in portlet JSF

Toshiro Mifune,修改在8 年前。

File path in portlet JSF

Regular Member 帖子: 238 加入日期: 14-12-11 最近的帖子
Hi all,

I am trying to send email with JSF portlet+JAVA but I can't find a real file PATH. My code:

String filename = "\\downLoadForm-portlet\\docroot\\zip_rar\\" + "fileD.zip"; /// there is my problem + what is correct PATH ?
				    FileDataSource fds = new FileDataSource(filename);				    
				    message.setDataHandler(new DataHandler(fds));
				    message.setFileName(fds.getName());


thanks for answers !
Toshiro Mifune,修改在8 年前。

RE: File path in portlet JSF (答复)

Regular Member 帖子: 238 加入日期: 14-12-11 最近的帖子
The solution is >> String realPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath("zip_rar/confession.zip");
thumbnail
Juan Gonzalez,修改在8 年前。

RE: File path in portlet JSF

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Thanks for post the solution. Please can you mark your answer as the right one?
thumbnail
Juan Gonzalez,修改在8 年前。

Moving to Liferay Faces category

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Moving to Liferay Faces category