I've calculated the total form submission in the backend, and now I need to display it beside the "total submission" tag on the JSP page. I've tried a variety of approaches, but nothing seems to be working. What is the best approach to show the long value on a jsp page?
JSP PAGE
<div>
<dt>Submissions</dt>
<dd>Total Submissions:-</dd> // " here i need to put the total sub value"
</div>
CONTROLLER
long number = flowSubService.totalSubmissions() formSubService.totalSubmissions();
DashBoardBean bean= new DashBoardBean();
bean.setTotalSubmissions(number);
mv.addObject("totalSub",number);
public long getTotalSubmissions() {
return totalSubmissions;
}
public void setTotalSubmissions(long totalSubmissions) {
this.totalSubmissions = totalSubmissions;
}
CodePudding user response:
Usually you put the object in the HttpResponse object of the servlet and forward it (read this for an example: Pass variables from servlet to jsp )
after this in the jsp you get the object (or the value directly) and <%=valueToShow%>
CodePudding user response:
if the bean is included in your model:
<div>
<dt>Submissions</dt>
<dt><form:input path="totalSubmissions" readonly="true" /></dt>
</div>