I dont want a page forward. And also want to avoid javascript.
I think opting out both can't be possible.
You use jQuery/Ajax
call to display data on the same page without submitting it.
Example:
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
function getData() {
var dataToBeSent = {
param1 : $("#jobs").val() ,
param2: $("#process").val()
}; // you can change parameter name
$.ajax({
url : 'getDataServlet', // Your Servlet mapping or JSP(not suggested)
data :dataToBeSent,
type : 'POST',
dataType : 'html', // Returns HTML as plain text; included script tags are evaluated when inserted in the DOM.
success : function(response) {
$('#outputDiv').html(response); // create an empty div in your page with some id
},
error : function(request, textStatus, errorThrown) {
alert(errorThrown);
}
});
}
});
HTML From Your Example:
Number of jobs: <select name="jobs" id="jobs">
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="500">500</option>
</select><br>
Number of PE:<select name="process" id="process">
<option value="2">2</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="25">25</option>
</select>
<input type=submit value="Submit" onClick=getData();>