• 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

Null fileupload with Tomahawk on JSF 2.0

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need to create a file upload functionality in a JSF 2.0 application.

I'm using Tomahawk as explained by BalusC in this post:
https://stackoverflow.com/questions/5418292/jsf-2-0-file-upload

When I click submit, it gets to the submit method, but the value of uploadedFile is null.

Why doesn't it have its content?

This is the code.



 
Jf Okeeffe
Ranch Hand
Posts: 89
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the solution.

enctype="multipart/form-data" was missing from the form tag.
When added that, it worked.
Thanks.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some cautions here:

That is a really old question/answer page. As far as I know, JSF 2.2 and newer don't need/shouldn't use Tomahawk for file uploads, since that capability is now part of the JSF core tag set.

Furthermore, I'm really not certain about using Tomahawk at all. The actual Tomahawk component of Apache MyFaces is deprecated. I haven't looked at modern MyFaces docs to see what they say about the "t" tagset, though.

 
Jf Okeeffe
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

The question I posted yesterday. It's something I'm needing now.

But yes, it's indeed about an older technology.

The thing is that I'm working on an application that was developed in JSF 2.0 (not 2.2).

And needed to create an upload functionality to it.

So Tomahawk was the solution I could find.

Sometimes we need to post questions here about old technlogies because these technologies are still in the market being used by companies we work for.

There's a lot of that.

So it's important that the online foruns provide support for these older technologies as well.

And that I have found to be difficult. People usually reply much more to questions on newer tech and much lesser to older ones that are also needed.
 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand, although the original StackOverflow question predates even Java 2.0, I think.

One thing to keep in mind, however, is technology rot. I don't think it should be all that difficult to migrate from JSF2.0 to JSF2.2 or 2.3, but software doesn't last forever, no matter what Management thinks. It decays from the outside in. It's the classic band-aid case where you can either suffer many annoying small jerks or one big agonizing jerk. With the added caution that the pain - and cost - accelerates as time goes by until, if you pardon the metaphor, you have to yank so hard that body parts come off.
 
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic