I have a jsp page. In jsp page i have array of objects say history. In the jquery, i have got the index.Now i want to pass history[index] object to the action class in struts2. Here is the code which i have tried but it is showing error.
$(document).ready(function() {
$(function() {
var rateDialog = $("#rateDialog").dialog({
autoOpen: false,
minHeight:250,
width: 400,
height: 265,
open: function( event, ui ) {
$("#showDialogMessage").hide();
$('#reviewArea').val('');
}
});
$(".rate").on("click", function() {
// Display the dialog
rateDialog.dialog("open");
alert( $(this).attr("id") );
var index = $(this).attr("id");
alert("${history.get(index)}");
});
});
$("#submit").click(function(e) {
$("#showDialogMessage").hide();
var xmlhttp;
$("#submit").prop('disabled',true);
alert("called");
var url="rate?object="+${history.get(index)};
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
$("#submit").removeAttr('disabled');
document.getElementById("showPasswordMessage").innerHTML=xmlhttp.responseText;
$("#showPasswordMessage").show();
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
});
});
var url="rate?object="+${history.get(index)};
This is not a java question, this is javascript. The above line is the culprit
${history.get(index)}
is jsp code executing on the server and it fetches an object. What is printed is the toString() representation of the object (com.markEffy.aggregator.TransactionDetails@6e0bbea6). You probably should be accessing a property on the object
${history.get(index).someProperty}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.