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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:02:40+00:00 2026-05-13T15:02:40+00:00

I have the following form setup: <html> <head></head> <body> <form method=post enctype=multipart/form-data action=FileUpload> <table>

  • 0

I have the following form setup:

<html>
<head></head>

<body>
<form method="post" enctype="multipart/form-data" action="FileUpload">
    <table>
        <th>WEX SI Online Validation</th>
        <tr>
            <td>Step 1: Select File for Validation: </td>
            <td><input name="filename" type="file"/></td>
        </tr>
        <tr>
            <td>Step 2: Validate File:</td>
            <td><input name="validate" type="button" value="Validate"/></td>
        </tr>
        <tr>
            <td>Step 3: Download and Fix Errors:</td>
            <td><input name="download" type="button" value="Download"/></td>
        </tr>
        <tr>
            <td>Step 4: Submit</td>
            <td><input name="submit" type="submit" value="Submit"/></td>
        </tr>
    </table>
</form>
</body>

</html>

How should I handle this? I’m using Java/JSP/Servlets but am not sure how to handle the post for the upload portion of this and than the other actions.

I think it would be best to create some kind of form controller that handled the post of the form and delegated to other servlets depending on what the user is doing. I’m not sure how to tell what the user has selected though.

  • 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-13T15:02:40+00:00Added an answer on May 13, 2026 at 3:02 pm

    As for every other normal <input> element, the name-value pair of a <input type="button"> will be sent as request parameter.

    The major caveat is only that <input type="button"> and <button> elements does not work properly in MSIE. In all MSIE versions, the value attribute of a button element won’t be sent as parameter value, but instead its body (the tag content) will be sent!

    Also, in IE6 there’s another astonishing bug: not only the name-value pair of the pressed button will be sent, but those of every other unpressed button in the form will be sent as well! This way you cannot distinguish the pressed button in the server side at all.

    The solution which works in combination with all browsers is to use <input type="submit"> and to give them all a different name (or the same name but a different value).

    E.g.

    <input type="submit" name="validate" value="Validate">
    <input type="submit" name="download" value="Download">
    <input type="submit" name="submit" value="Submit">
    

    in combination with

    if (request.getParameter("validate") != null) {
        // Validate button pressed.
    } else if (request.getParameter("download") != null) {
        // Download button pressed.
    } else if (request.getParameter("submit") != null) {
        // Submit button pressed.
    }
    

    or

    <input type="submit" name="action" value="Validate">
    <input type="submit" name="action" value="Download">
    <input type="submit" name="action" value="Submit">
    

    in combination with

    String action = request.getParameter("action");
    if ("Validate".equals(action)) {
        // Validate button pressed.
    } else if ("Download".equals(action)) {
        // Download button pressed.
    } else if ("Submit".equals(action)) {
        // Submit button pressed.
    }
    

    The last way provides more possibilities to abstract the one and other more nicely away at Java level.

    By the way, I of course assume that you’re already using Apache Commons FileUpload to process the multipart form data, if necessary with help of a Filter which puts the multipart form data back in the request parameter map, else you won’t get anything from HttpServletRequest#getParameter().

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

Sidebar

Related Questions

I have an HTML form POSTing to the following index.php: <?php require_once(/home/full/path/to/included/file.php); ?> And
I have code with the following form: <?php function doSomething{ //Do stuff with MySQL
I have an SQL query that takes the following form: UPDATE foo SET flag=true
I have a version number of the following form: version.release.modification where version, release and
I have a rewrite rule of the following form: RewriteRule ^foo/([a-zA-Z0-9]+)$ foo.php?arg=$1 [qsa,nc] It
I have the following situation: I built an Access form with a subform (which
I have the following scenario I have a main form as MDI parent and
In every form we derive from FormBaseControl , we have the following code. I'm
I have a really simple search form with the following Label (Search) Textbox (fixed
I have in my Form constructor, after the InitializeComponent the following code: using (WebClient

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.