iec2011007
iec2011007

Reputation: 1846

Send data from an HTML select to a Servlet

I have a scheduleMeet.jsp page

<select name="Dept">
    <option value="Personalization">Personalization</option>
    <option value="WebDevelopment">WebDevelopment</option>
    <option value="MobileApp">MobileApp</option>
</select>
<input type="submit"/>

And I want to send the data when the user selects one of the option from dropdown to a servlet.

Can someone suggest code snippet for the Servlet?

Upvotes: 1

Views: 348

Answers (2)

Zack Schulfler
Zack Schulfler

Reputation: 78

String Department= request.getParameter("Dept");

So you will get data from one of option's value. If you don't believe it, you can print out the Department object like:

System.out.println(Department);

Upvotes: 1

SMA
SMA

Reputation: 37023

You could get multiple selection using :

String[] assignedResources = request.getParameterValues("Dept");

Upvotes: 0

Related Questions