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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:34:02+00:00 2026-05-22T17:34:02+00:00

i have a Backing Bean in which i read parameter which are not bound

  • 0

i have a Backing Bean in which i read parameter which are not bound to a component. Seam offered that to read get parameter. I used

@RequestParameter private String param1;

this way he doesn’t skip my action method on a validation error, like when i used
<param name=”param1″ value=”#{myBean.param1}” />
, because i don’t want to render HTML responses but reuse the business logic. Instead i grab the response stream and write the rendered response myself

FacesContext ctx = FacesContext.getCurrentInstance();

final HttpServletResponse resp = (HttpServletResponse)ctx.getExternalContext().getResponse();      
resp.getOutputStream().write(xml.getBytes());
resp.getOutputStream().flush();
resp.getOutputStream().close();

ctx.responseComplete(); // render response phase done

I tried to read the file from the HttpServletRequest inputStream but that was already empty. Is there a way to still get the “file” from JSF. I could use a separate servlet and handle it there, but that would break a little bit how i build the rest of the interface.

Thx for any advice.

Edit: Just for completeness the code for the input stream

final HttpServletRequest request = (HttpServletRequest)ctx.getExternalContext().getRequest();
ServletInputStream stream = request.getInputStream();
int byt = stream.read(); // byt was -1

Edit Edit: Sorry for the long post. Now i made a separate servlet. There i also get an empty input Stream even though Firefug said i transmitted the file. How can that be empty?

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

boolean isMultipart = ServletFileUpload.isMultipartContent(req);
ServletInputStream stream= req.getInputStream();
int test = stream.read(); // test == -1

That servlet code works fine in a separate project, so one of the JSF/Seam servlets in the filter chain has to remove the data. If someone has a hint which one or how to check.

  • 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-22T17:34:03+00:00Added an answer on May 22, 2026 at 5:34 pm

    The SeamFilter or more exactly the MultipartFilter was checking every request if it is a POST and multipart request. If so, they wrapped the request in a MultipartRequest and put the files in a separate parameter map.

    final HttpServletRequestWrapper request = (HttpServletRequestWrapper)FacesContext.getCurrentInstance().getExternalContext().getRequest();
    final ServletRequest innerRequest = request.getRequest();
    if(innerRequest instanceof MultipartRequest){
        byte[] imageData = ((MultipartRequest)innerRequest).getFileBytes("image");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with selectInputDate: I have a backing bean which I am
I have Facelet component and I have backing bean for it. When I include
I have a web application with a backing bean which has the context of
I have a java backing bean which has a method (call it getDataList() )
If I have a form-backing object that has a complicated object tree -- say
I have a simple JSF+RichFaces form with some fields and obviously a backing bean
In JSF, we can bind HtmlDataTable to backing bean and get the row data.
Ok, so basically I have a jspf template file with a backing FragmentBean that
I have a backing bean, and I'd like to load up a few lists
I have the following conversation scoped backing bean: @Named @ConversationScoped public class TestConversation implements

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.