Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   How to upload the Files with JSf and Myfaces (http://www.go4expert.com/forums/upload-files-jsf-myfaces-t2437/)

Goutham 4Jan2007 17:18

How to upload the Files with JSf and Myfaces
 
hi ,

i have used
Code:

    <filter-mapping>
          <filter-name>extensionsFilter</filter-name>
        <url-pattern>*.jsf</url-pattern>
        </filter-mapping>
    <filter-mapping>
        <filter-name>extensionsFilter</filter-name>
        <url-pattern>/faces/*</url-pattern>
    </filter-mapping>

in web.xml file

Bean class
Code:

public class FileUploadForm
{
    private UploadedFile _upFile;
    private String _name = "";

    public UploadedFile getUpFile()
    {
        return _upFile;
    }

    public void setUpFile(UploadedFile upFile)
    {
        _upFile = upFile;
    }

    public String getName()
    {
        return _name;
    }

    public void setName(String name)
    {
        _name = name;
    }

    public String upload() throws IOException
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        facesContext.getExternalContext().getApplicationMap().put
("fileupload_bytes", _upFile.getBytes());
        facesContext.getExternalContext().getApplicationMap().put
("fileupload_type", _upFile.getContentType());
        facesContext.getExternalContext().getApplicationMap().put
("fileupload_name", _upFile.getName());
        return "ok";
    }

    public boolean isUploaded()
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        return facesContext.getExternalContext().getApplicationMap().get
("fileupload_bytes")!=null;
    }

  public String saveStyle()
  {
    System.out.println("Hello from saveStyle");
    return "Hello from saveStyle";
  }

}

But it is showing Error as

cannot find symbol
[javac] symbol : class UploadedFile
[javac] private UploadedFile upFile;
can anybody Help in this Regard

Goutham 4Jan2007 17:19

Re: How to upload the Files with JSf and Myfaces
 
Plz send Reply to this Query

shabbir 5Jan2007 09:40

Re: How to upload the Files with JSf and Myfaces
 
Try using the code block for putting your code snippets in the post.

Also moved the thread from Introduce yourself to JSP forum.


All times are GMT +5.5. The time now is 22:44.