How do submit an object to a struts2 action using jQuery?
Posted
by
James Drinkard
on Stack Overflow
See other posts from Stack Overflow
or by James Drinkard
Published on 2012-06-21T22:48:05Z
Indexed on
2012/06/22
3:16 UTC
Read the original article
Hit count: 114
I have an object that I'm populating from a selection off a table row that a user selects. I have a jQuery function that captures the click event and a hidden form field populates an id I need.
However, I'm not sure as to the proper way to send off that object to a struts2 action? I tried using this:
$(function() {
$('#tbl tr').click(function() {
var id = $(this).closest('tr').find('input:hidden').val();
var page = "<s:url action='update/deleteInfo.action'/>?model.isDelete=true&model.info.id=id";
console.log(page);
window.location.href=(page);
});
});
The model object has an isDelete boolean variable and the model has a nested info object that has an id variable with getter/setters.
However, when I send this across, the model object isn't populated with these entries. Is there a way to do this or a better way than the url tag?
© Stack Overflow or respective owner