webtier@glassfish.java.net

Re: creating a file from managed bean.

From: <webtier_at_javadesktop.org>
Date: Tue, 17 Aug 2010 10:30:47 PDT

Hi,

> hello Manuel, thank you for your answer. The problem
> is solved now. but I made a modification since the
> original code you gave me did not work. your code
> throws the following exception:
> java.lang.ClassCastException:
> com.sun.faces.context.ExternalContextImpl cannot be
> cast to javax.servlet.ServletContext

sorry, I forgot the last bit, should've been

[code]FacesContext.getCurrentInstance().getExternalContext().getContext()[/code]

but indeed you can now use getRealPath() directly on the ExternalContext, cool

Manuel
[Message sent by forum member 'manuelbernhardt']

http://forums.java.net/jive/thread.jspa?messageID=480419