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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:09:47+00:00 2026-06-15T05:09:47+00:00

Trying to submit checked selectbox value(on at a time) along with textbox value to

  • 0

Trying to submit checked selectbox value(on at a time) along with textbox value to a servlet;here is my code(jsp) :

<script type="text/javascript">
function search(){
document.f2.action="/InfoUser/SearchBox";
document.f2.submit();
}
</script>

<form name="f2">
<div align="right">
<select id="select" name="select" style="color:#2D7EE7">
<option> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------- </option>
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
</select> 
<input type="text" name="search" style="color:#2D7EE7">
<input type="submit" value="Search" onclick="search()">
</div>
</form>

and in the servlet : I have written

String[] select = request.getParameterValues("select");
String search = request.getParameter("search");

Unable to fetch the value in servlet,am I missing some javascript/jquery script to get the value in servlet & how I can use it with the help of JSTL.Any rectification if I’m going wrong …..feel free to comment,will be welcome.

  • 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-15T05:09:48+00:00Added an answer on June 15, 2026 at 5:09 am

    Try to change your form:

    <form action="/InfoUser/SearchBox">
        <div align="right">
            <select id="select" name="select" style="color:#2D7EE7">
                <option> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -----------</option>
                <option value="a">A</option>
                <option value="b">B</option>
                <option value="c">C</option>
            </select>
            <input type="text" name="search" style="color:#2D7EE7">
            <input type="submit" value="Search">
        </div>
    </form>
    

    Or:

    <script type="text/javascript">
        function search(){
            document.f2.action="/InfoUser/SearchBox";
            document.f2.submit();
        }
    </script>
    
    <form name="f2">
        <div align="right">
            <select id="select" name="select" style="color:#2D7EE7">
                <option> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------- </option>
                <option value="a">A</option>
                <option value="b">B</option>
                <option value="c">C</option>
            </select>
            <input type="text" name="search" style="color:#2D7EE7">
            <input type="submit" value="Search" onclick="search()">
        </div>
    </form>
    

    You are missing the name of the form and in your javascript you are trying to set the action on non-existing form.

    In servlet you have to do:

    String select = request.getParameter("select");
    String search = request.getParameter("search");
    

    You won’t be able to use: String[] select = request.getParameterValues("select"); unless your select element will have multiple="true".

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

Sidebar

Related Questions

i am trying to submit 2 forms at the same time im trying to
I'm trying to submit a few forms through a Python script, I'm using the
I was trying to make this example here work, but unable hide submit button
i'm trying to run a function after checkbox checked and pushed submit button with
I am trying to send two arguments (textbox&value in checkbox) using form with specific
Im trying to submit a specific form programatically, but I allways get the initial
I'm trying to submit a form (it's a dynamic form with fields added via
I am trying to submit two forms at once (one goes to db and
I'm trying to submit a form entry with an uploaded file, but I can't
I'm trying to submit a form when a select changes using jQuery Mobile. I

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.