Hi guys, i'm doing my FYP, and facing the following problem.
below is my code for the javaScript

<script language="JavaScript">
function deleteAccount(ckId){
  alert(ckId);
  var index = document.getElementById(ckId).value;
  document.getElementById('hiddenind').value = index;
  var conf = confirm("Are you sure you want to permanently remove this account?");
  if(conf == true)
	{
	document.form.action = "<%=contextPath%>/AccServlet?tranx=deleteAccount&empId=]?";
	document.form.submit();
        }
  else
  return;
 }
</script>

then inside the form

<input name="checkboxes" type="checkbox" value=""        onclick="deleteAccount(<%=accDto.getEmpId() %>)" />

I have test that the data can be pass to javascript using alert(ckId);. However the data can't be pass to this line in javascript:
document.form.action = "<%=contextPath%>/AccServlet?tranx=deleteAccount&empId=?

The '?' at the end of the line suppose to get the value of ckId and pass to servlet. However no matter how i try , thing i write to replace the '?' symbol is pass to servlet only, not its value.
========================================================
Below is the code inside the servlet:

if (request.getParameter("tranx").equalsIgnoreCase("deleteAccount")){
	url="/Acc/DeleteAcc.jsp";
	request.getParameter(empId);
	System.out.println("Test empId value: "+empId);
	accBean.deleteAcc(empId);
	dispatcher = getServletContext().getRequestDispatcher(url);
        dispatcher.forward(request, response);
	return;
	}

Hi guys, i'm doing my FYP, and facing the following problem.
below is my code for the javaScript

<script language="JavaScript">
function deleteAccount(ckId){
  alert(ckId);
  var index = document.getElementById(ckId).value;
  document.getElementById('hiddenind').value = index;
  var conf = confirm("Are you sure you want to permanently remove this account?");
  if(conf == true)
	{
	document.form.action = "<%=contextPath%>/AccServlet?tranx=deleteAccount&empId=]?";
	document.form.submit();
        }
  else
  return;
 }
</script>

then inside the form

<input name="checkboxes" type="checkbox" value=""        onclick="deleteAccount(<%=accDto.getEmpId() %>)" />

I have test that the data can be pass to javascript using alert(ckId);. However the data can't be pass to this line in javascript:
document.form.action = "<%=contextPath%>/AccServlet?tranx=deleteAccount&empId=?

The '?' at the end of the line suppose to get the value of ckId and pass to servlet. However no matter how i try , thing i write to replace the '?' symbol is pass to servlet only, not its value.
========================================================
Below is the code inside the servlet:

if (request.getParameter("tranx").equalsIgnoreCase("deleteAccount")){
	url="/Acc/DeleteAcc.jsp";
	request.getParameter(empId);
	System.out.println("Test empId value: "+empId);
	accBean.deleteAcc(empId);
	dispatcher = getServletContext().getRequestDispatcher(url);
        dispatcher.forward(request, response);
	return;
	}

lolx i also wanna know!! no ppl here?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.