Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

UploadedFile Implementation

 
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Maybe he went home and went to bed. And took this tiny ad with him:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic