Reputation: 1455
I have a jQuery dialogue box which contains values as checkboxes. On selecting the checkboxes I am storing the selected values into label. Next I have to send these values from label as parameter through form to servlet but I don't know how to complete it.
Here is my code:
<form action="CallTimer" method="GET">
<label class="button2">Set Date: </label>
<input type="text" name="date" id="date" size="4">
<input type="Submit" name="Submit" value="Submit" id="Submit">
<br/>
<a href="javascript:void(0)" id="departmentlink" class="button2">Select Reporting Level</a>
<label class="button2" style="display:none" id="depart"> Department</label>
</form>
I am retrieving these parameters in my Servlet as:
String reportname=request.getParameter("depart");
System.out.println(reportname);
But it is returning null values. Please help me.
Thanks in advance.
Upvotes: 1
Views: 5491
Reputation: 313
You have to use hidden input field:
<input type="hidden" name="depart" />
Upvotes: 3
Reputation: 8057
You need to understand what gets passed on form submission and what is not. In a nutshell, only values of the input fields get sent to the server. You have several ways to solve your problem:
Modify the query string (what gets sent after ? in your GET request) during form submission (using java script):
?...&depart=xxx
Upvotes: 1