<%@ taglib uri="/hawtags" prefix="haw" %>
<!-- 
  HAWHAW example for usage of checkboxes
  Norbert Huffschmid
  $Date: 2007/12/05 22:10:57 $
-->
<haw:haw>
  <haw:deck title="Correct?">

  <% if (request.getParameter("solution") == null) { %>

    <haw:form action="<%= request.getRequestURL().toString() %>">
      <haw:checkbox name="c1" value="c" label="2+3=6"/>
      <haw:checkbox name="c2" value="c" label="SIN(PI)=0"/>
      <haw:checkbox name="c3" value="c" label="SQRT(16)=4"/>
      <haw:submit label="Solution" name="solution"/>
    </haw:form>
    
  <% }
     else {
    	 
       int points = 0;

       if ((request.getParameter("c1") == null) || (!request.getParameter("c1").equals("c"))) {
           points += 1;
         }

       if ((request.getParameter("c2") != null) && (request.getParameter("c2").equals("c"))) {
           points += 2;
         }

       if ((request.getParameter("c3") != null) && (request.getParameter("c3").equals("c"))) {
           points += 3;
         } %>

    <haw:text>Your reached <%= points %> from 6 points.</haw:text>
 
  <% } %>

  </haw:deck>
</haw:haw>