I have a .jsp file with JavaScript.
If I click to the OK button, I call a JavaScript method. This method detects an id.
I want to send this id to my servlet. In my servlet I want to get the id with getParameter(id)
.
I have implemented this on my local machine, and it functions well. If I deploy my source code on the sever, the JavaScript method will be called and the id will be detected, but the method doesn't send a request to my servlet.
<script language="text/javascript">
function removeLink(){
var id='';
var tmpcounter=0;
var check=0;
for (var counter = 0; counter < (document.getElementsByName("inProject[]").length); counter++) {
if (document.getElementsByName("inProject[]")[counter].checked) {
tmpcounter = tmpcounter+1;
}
}
for (var zaehler = 0; zaehler < (document.getElementsByName("inProject[]").length); zaehler++) {
if (document.getElementsByName("inProject[]")[zaehler].checked) {
check++;
if((check == tmpcounter) || (tmpcounter==1)){
id += 'id='+ document.getElementsByName("inProject[]")[zaehler].value;
}else{
id += 'id='+ document.getElementsByName("inProject[]")[zaehler].value +' OR ';
}
}
}
alert(id);
location.href='<%=request.getContextPath()%>/issues?action=uploaddeletelink&wherestatement=' + id;
close();
}
//-->
</script>
And this is my OK button:
<td align='right'><a class='funktion' href='javascript:removeLink();'>OK<IMG src="<%=request.getContextPath()%>/issuedb/system/layout/funktionpfeil.gif" width="14" height="9" border="0"></a></td>
On my server, the function will be called, and the id will be detected. The line of code below, which sends the request to my servlet, doesn't function however.
location.href='<%=request.getContextPath()%>/issues?action=uploaddeletelink&wherestatement=' + id;