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

  • Home
  • SEARCH
  • 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 6359091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:28:23+00:00 2026-05-24T23:28:23+00:00

I want to extract all the values for a specific drop down list box

  • 0

I want to extract all the values for a specific drop down list box in a web form.

In the source code of this web form, the relevant code for this particular drop down, is given below–

<div align="left"><select name="CATEGORY_ID">
<option label="[Top]" value="0" selected="selected">[Top]</option>
<option label="|___Arts &amp; Humanities" value="1">|___Arts &amp; Humanities</option>
<option label="|&nbsp;&nbsp;&nbsp;|___Art History" value="2">|&nbsp;&nbsp;&nbsp;|___Art History</option>
----many more values----
<option label="|&nbsp;&nbsp;&nbsp;|___Work" value="453">|&nbsp;&nbsp;nbsp;|___Work</option>

</select>
</div>

I want to extract both the actual values (ie option … value=”” ) as well as the value shown on screen (ie option label=”” )…Can this be done in JSP/Java? And ideally done using only classes supported by Google App Engine? (Even if you can suggest a way to do this but are not sure if that way is supported by Google App Engine for Java, even then kindly suggest your method…)

  • 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-24T23:28:24+00:00Added an answer on May 24, 2026 at 11:28 pm

    Easiest is to use a HTML parser for this. I don’t think that GAE ships with any one. But you should be able to drop one in your /WEB-INF/lib. I’d suggest to grab Jsoup for this job. You should then able to obtain all options of a <select name="CATEGORY_ID"> of the external website as follows in a servlet:

    Map<String, String> options = new LinkedHashMap<String, String>();
    Document document = Jsoup.connect("http://other.com/some.html").get();
    
    for (Element option : document.select("select[name=CATEGORY_ID] options")) {
        options.put(option.attr("value"), option.text());
    }
    
    request.setAttribute("options", options);
    request.getRequestDispatcher("/WEB-INF/some.jsp").forward(request, response);
    

    And then in JSP redisplay it as follows:

    <select name="category">
        <c:forEach items="${options}" var="option">
            <option value="${option.key}"><c:out value="${option.value}" /></option>
        </c:forEach>
    </select>
    

    The label attribute is by the way unnecessary as it’s a silly MSIE-proprietary attribute. It’s the body of the <option> element which is to be shown as visible label.

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

Sidebar

Related Questions

I want to parse a web page in Groovy and extract all of the
I want to extract from a webpage all URLs how can I do that
i want to extract some text in certain website. here is web address what
I want to extract just the file name portion of a path. My code
I want to obtain all the replaced values in the following exception from error
I have a scenario where I want to parse through all the values displayed
I want to read all page inputs ids and values into object and pass
I am crawling a page www.thenextweb.com I want to extract all the post links,
I have a MySQL table and I want to extract all rows except if
I want to extract values from music structure directories using File::Find::Rule and I'm having

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.