To implement a functionality where clicking on a delete button in the UI triggers a service method that retrieves data from a database and displays it in a popup, I need to call a specific method in an Action class. The task id and command name (method name) are added to the query string for this purpose. However, when trying to retrieve the command parameter using request.getParameter("command")
, it returns null.
I am looking for a JavaScript method to handle this issue.
function ajaxGetDependentTask(id)
{
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP") // For Old Microsoft Browsers
}
catch (e)
{
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP") // For Microsoft IE 6.0+
}
catch (e2)
{
xmlHttp = false // No Browser accepts the XMLHTTP Object then false
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined')
{
xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers
}
var url = "/admin/TaskEdit.do?id=" + id + "&command=findDependenciesFor";
xmlHttp.open("GET", url, true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange = handleServletResponse;
xmlHttp.send();
}
The issue lies with the form submission process and the resulting query string being null.