• Post Reply Bookmark Topic Watch Topic
  • New Topic

UploadedFile Implementation

 
Vijayanarayana Reddy Bhoomireddy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to develop a functionality using Tomahawk.jar

In the JSP, I have used <t:inputFileUpload> tag and I have set the value property to #{documentbean.uploadedFile}. Here documentbean is the bean class and uploadedFile is of type UploadedFile.

When I tried to use uploadedFile.getName(), application is throwing a NullPointerException. On careful examination, I found UploadedFile is an interface.

Do I need to create a class implementing UploadedFile interface and implement all the methods before I use them?

Please help me here as am stuck

Regards
Vijay
 
Bandaru Ramesh
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,
Not requited to implement any class for the <t:inputFileUpload> tag usage,
check for the form tag to set attribute enctype="multipart/form-data" to support file upload.

With and ,
Ramesh
 
Vijayanarayana Reddy Bhoomireddy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have actually set the form attribute to enctype="multipart/form-data"

Can anyone explain if my approach is wrong? How/where is the instance of a class which implements UploadedFile is created? Still I'm not able to understand how uploadedFile.getName() is accessible when no instance is created. My code in the bean class is as below:



Any help in this regard is grateful

Regards
Vijay
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the ExtensionsFilter properly configured? Apparently not. It is the one which should put the file back as a bean property.
Carefully read this article: http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html

That said, I'd work on about your understanding of interfaces and polymorphism. That is really not the problem here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!