I want to pass data from hands on table to servlet . I have tried a method in which I am able to get the data when iItry to pass to servlet I am not able to get the data from request.getParameter("forecastdata");
which is null. Please tell what is the mistake in my code ArrayToJson
@WebServlet("/arrayToJson/*")
public class ArrayToJson extends HttpServlet {
@Override
protected void doPost(final HttpServletRequest request,
final HttpServletResponse response) throws ServletException,
IOException {
StringBuffer jb = new StringBuffer();
String line = null;
request.getParameter("forecastdata");
;
}
}
JavaScript
$("#divButtons").find(".btnSubmit").click(function () {
console.log($container.data('handsontable').getData());
var forecast=$container.data('handsontable').getData()
$.ajax({
url: "/Pj_IFRS_P5/arrayToJson",
data: {
forecastdata: forecast
}, //returns all cells' data
dataType: 'json',
type: 'POST',
success: function (data) {
if (data.result === 'ok') {
console.log('Data saved');
} else {
console.log('Save error');
}
},
error: function () {
console.log('Save error. POST method is not allowed on GitHub Pages. Run this example on your own server to see the success message.');
}
});
});
$("#handsontable").handsontable(config);
});
since you're using jquery you can check your condition and disable the row fully by using a filter. there are lot of examples out there and even in stackoverflow .
one example and fiddle is HERE
if that is your case now, this might answer it !
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.