Posts

Showing posts with the label jsp

Passing data from java file to ajax

Passing data from java file to ajax I have a java class printing the progress of a process as 1%, 2%, 3%. Now I want to read this progress using AJAX requests and continuously update the progress in the webpage. I cannot convert the java file into a servlet as it is being used as an scriptlet by Jasper. Scriptlet code is : public void afterDetailEval() throws JRScriptletException{ count = (Integer) this.getVariableValue("count"); out.println(count); Thread.sleep(200); } How can I read the data printed by java from an AJAX request? Any help will be greatly appreciated! What do you think about your choice to not show the code you have that's doing the stuff you just described, while also asking for help about just these things? – kumesana Jul 1 at 20:07 what is your java class running ...

jstl c:set is not working on js code in jsp file

jstl c:set is not working on js code in jsp file I have a JSON from a service. I am appending a html block by JSON value and I have to check some values for appropriate display. I am trying to set discountValue variable but it not working with js variable. How can I solve it? if (data!="") { $.each(data,function(index,element){ var intDiscount=parseInt(10); console.log("intDiscount::"+intDiscount); var strIndex=''; strIndex+='<div class="card">'; strIndex+='<c:set var="discountValue" value="'+intDiscount+'"/>'; console.log("${discountValue}"); ... ... ... ... } $('#visilabs-FavouriteCategoryTopSeller').append(strIndex); Console log: intDiscount::10 0 ...