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

The Archive Base Latest Questions

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

I have a simple JSP that contains checkbox and submit button: <form action=MappingSubmit.jsp enctype=multipart/form-data

  • 0

I have a simple JSP that contains checkbox and submit button:

<form action="MappingSubmit.jsp" enctype="multipart/form-data" method="POST" name="fileSubmit">
<input type="checkbox" name="scan" value="scan">Scan immediately<br><br>
<input type="submit" value="Submit">
</form>

and a second JSP that should read the submitted data:

<body>
<%
    response.getWriter().println(request.getParameter("scan"));
%>
</body>

The problem is that getParameter always returns null.
If I remove the enctype from the form, it works.
Why? No way to use checkbox in a multipart/form-data form?

Thanks
Udi

  • 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:48:26+00:00Added an answer on May 23, 2026 at 1:48 pm

    The default HTML form encoding is application/x-www-form-urlencoded. The getParameter() method is relying on this. Other form encodings are not supported by getParameter(). When you’re using Servlet 3.0, you should be using getParts() for this instead. Or when you’re using Servlet 2.5 or older and/or when you’re using a multipart/form-data parser already such as Apache Commons FileUpload, then you should be using this instead to extract the parts.

    If you’re not using a file upload element <input type="file"> in the same form, then you don’t need the enctype="multipart/form-data" at all. You could just remove it so that it defaults to application/x-www-form-urlencoded and you can use getParameter() the usual way.

    See also:

    • How to upload files to server using JSP/Servlet?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple jsp form that the customer uses to send us emails.
I have a simple search page with this text input form <form name=assetInput action=assetResult.jsp
I have a jsp file that contains this code, <form id=testForm> <input type=hidden value=study--study
I have simple php validation form that is halfway working. If you leave the
I have a view Search.jsp that has a form:form that is connected to a
I have a form JSP web page, this form contains multiple instances of the
I have developed a simple application such as insertion, updation in jsp,servlet that is
I have created a simple JSP file that I want to deploy in Jetty
I have started a simple servlet 3.0 project which contains now a jsp page
I have a simple Struts2 app that is serving JSP files just fine. But

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.