Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6098587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:10:31+00:00 2026-05-23T13:10:31+00:00

I have a JSF page that has a h:form that has some textfields and

  • 0

I have a JSF page that has a h:form that has some textfields and also an imageupload gadget from primefaces

My question is:
How can i get the text from the fields and assign them to some variable.(The objective is to separate the uploaded image/s from the text)

-What should i do?

-Do i need a filter, for that?

-Is there any easy way to achieve it with primefaces fileupload tool?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:10:31+00:00Added an answer on May 23, 2026 at 1:10 pm

    This is not trivial with PrimeFaces 2.2.1. The PF 2 file upload handling is a bit an epic fail. Under the covers it’s already not trivial to upload files with Ajax. The XMLHttpRequest object simply doesn’t support multipart/form-data requests. Lot of “Ajaxified” (to have the feeling of an asynchronous progress) file upload solutions are based on a hidden iframe or -as in case of PF- using Flash. The PF 2 one is based on Flash and this is not combinable with regular text inputs in order to submit all the data in one go.

    In PF 3 the file upload component has been greatly revised. Using “simple” file upload mode your problem should be solved. However, PF 3 is currently still in beta/alpha stage. You would need to do a lot of unit tests on your webapp to see if it doesn’t break on PF 3.

    If PF 3 is not an option, then your best bet is using Tomahawk 2.0 or homebrewing a JSF component.

    • JSF 2.0 File upload – Tomahawk 2.0 file upload tutorial
    • Uploading files with JSF 2.0 and Servlet 3.0 – Custom file upload component tutorial

    As to the filter, under the covers the FacesServlet uses HttpServletRequest#getParameter() to retrieve the submitted values. When you’re familiar with basic JSP/Servlet, you should know how this usually works. The default HTML form encoding is application/x-www-form-urlencoded. The getParameter() method is relying on this. However, to be able to send binary data along this, such as file uploads, this default form encoding is unsuitable. For this multipart/form-data should be used instead.

    However, with this form encoding the getParameter() calls won’t work anymore then. They will all return null. At its simplest form, you would need to parse the request body manually on a per-request basis. See also How to upload files to server using JSP/Servlet? However, this doesn’t work out in combination with JSF as it is relying on getParameter() calls in order to set the bean properties (model values) with submitted values and to invoke the command button/link action.

    So you would like to change the HttpServletRequest that way so that the getParameter() calls returns the proper values. For that a Filter is the right choice as it runs before any servlet such as the FacesServlet. The filter should then parse the multipart/form-data request body, create a parameter map and wrap and replace the original HttpServletRequest with a custom implementation which returns the right parameters and pass that request object instead through the chain so that JSF can use it fully transparently “the usual way”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSF page that displays a RichFaces Treeview, from a TreeNodeImpl model
We have a rich:comboBox on a JSF page which has a valueChangeListener that calls
I have a jsf page that contains some javascript includes. And I want to
I have JSF page has two drop down lists and I want to load
I have a JSF 2.0 application running on GlassFish v3. It has EJBs that
In my JSF page I have a combobox that updates a table when an
I have a JSF page which has a variable number inputText elements containing numeric
I have a JSF 2 composite component that employs some Ajax behavior. I want
I have a JSF page where users can enter their car into my database.
I have two dependent dropdowns on a JSF page that work fine. I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.