Why is this code not working????

<c:if test ="${sessionScope.qCounter == 0}">
                      <!-- {((Quiz1) (sessionScope.quizVal)).correctAnswer(sessionScope.boxval)) == 'true'}">!-->
                     <br><font size='3' color = 'red'>Your last answer was not correct!
                 Please try again!!</font><br>
                 </c:if>

qCounter and quizVal are a session scope attributes I declared like .

HttpSession s = request.getSession();
         s.setAttribute("quiz", new Quiz1());
     Quiz1 q = (Quiz1)s.getAttribute("quiz");
      s.setAttribute("qCounter", "1");
          request.setAttribute("quizVal", q);

please help :( why is my 'if' not doing anything?

Recommended Answers

All 3 Replies

I'm new to JSp but wouldn't tag begin with <% instead of <c:?

<% 
  if(sessionScope.qCounter == 0){
  <!--............do your stuff.....-->
}
else{
  <!--.................do your stuff .........-->
}
  %>

I'm new to JSp but wouldn't tag begin with <% instead of <c:?

<% 
  if(sessionScope.qCounter == 0){
  <!--............do your stuff.....-->
}
else{
  <!--.................do your stuff .........-->
}
  %>

Not if we are talking about JSTL library (check the end of me MVC tutorial ;) )

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.