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 8658715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:50:10+00:00 2026-06-12T15:50:10+00:00

I have an upload routine which is working for servlets. Now I was trying

  • 0

I have an upload routine which is working for servlets. Now I was trying to put this routine in a jsf managed bean like this:

 public void uploadFile() throws IOException, ServletException{

    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext externalContext = facesContext.getExternalContext();
    HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
    HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();


    Part filePart = request.getPart("item");
    String filename = getFilename(filePart);
    InputStream filecontent = filePart.getInputStream();

    //persist the data here

}

when trying to run it on the server, of course there is the error message: “PWC4016: Request.getPart is called without multipart configuration. Either add a @MultipartConfig to the servlet, or a multipart-config element to web.xml”

But I don’t know where to put this annotation, neither do I have the name of the jsf generated servlet of my managed bean so I can’t put it into the web.xml neither.
Is it generally a bad idea to put this routine into a managed bean or should I stick to the servlet variant?

  • 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-06-12T15:50:11+00:00Added an answer on June 12, 2026 at 3:50 pm

    The @MultipartConfig basically needs to be put on the FacesServlet. You can’t do it yourself, but this is already done for the upcoming JSF 2.2, complete with a new standard <h:inputFile> component with ajax support, see also JSF spec issue 802.

    Until then, your best bet is grabbing a 3rd party component library or homebrewing a custom component.

    • Tomahawk <t:inputFileUpload> – see also JSF 2.0 File upload
    • PrimeFaces <p:fileUpload> – see also How to use PrimeFaces p:fileUpload?
    • Custom <x:inputFile> – see also Uploading files with JSF 2.0 and Servlet 3.0
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a php site in which we have to upload images
I have an upload pictures form. I need to make sure that pictures which
On my asp.net 4.0 site I have a upload function which allow a user
I have a routine that uses a HttpURLConnection to upload a file via a
This is so frustrating ! i have upload our app to the appstore, and
I have upload images with url image successful on this way NSMutableDictionary* params =
I have an upload function in an MVC 3 project which store the files
i have upload some apps in android market.now i want to show or redirect
I'm saving an image upload using Paperclip in Rails, which is working fine. has_attached_file
i have an upload script with that i like to upload a couple of

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.