I have a database that stores questions inside of a Hashmap. This code is supposed to count the total amount of questions so that I have the total amount of questions rather than the highest primary key. Here is the code.
public String getTotalQuestions(HttpServletRequest request) {
Integer tId = 0;
Iterable<QuizQuestion> quizQuestions = quizQuestionDAO.findAll();
for(QuizQuestion quizQuestion:quizQuestions) {
tId++;
request.getSession().setAttribute("count",tId);
// This just shoes me that its counting with a reminder
System.out.println(tId);
System.out.println("Get this number printing in the JSP");
}
//returns to my jsp
return "dashboard/dashboard";
}
After returning to my JSP which looks like this :
<h1>Stats Board</h1>
<%--<c:forEach var="count" items="${tId}" >--%>
<div style="color:green;font-weight: bold;">
Total Questions: <c:out value="${count.tId}"/>
</div>
<%--</c:forEach>--%>
My JSTL is designed to print my total amount of questions on the view. However this is my error:
javax.el.PropertyNotFoundException: Property 'tId' not found on type
java.lang.Integer
I know that this is a similar questions to this link: Property 'someproperty' not found on type java.lang.String
But I have my setAttribute and it still does not work. where am I going wrong? Are there pieces I am using that I might not understand completely?