mercredi 23 octobre 2019

How can i check

the below code is from codejava.com website. But I can't understand how this code work because I am just start learning jstl in java. I don't know how this condition work <c:if test="${param.movieCheck == 'yes'}"> . i don't understand how param.movieCheck fetch radio button value. Can we fetch any component value using param.attributename ?ex. param.movieCheck value

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
     <title>&lt;c:if&gt; Demo</title>
   </head>
   <body>
     <h1>&lt;c:if&gt; Demo</h1>
     <c:if test="${param.movieCheck == 'yes'}">
         Ok! Great Choice!
     </c:if>
     <c:if test="${param.movieCheck == 'no'}">
         Oops! Perhaps you can try watching them!
     </c:if>
    <br/>
    <br/>
    <form name="ifForm"
        action="${pageContext.request.contextPath}/tag-types/core/if.jsp"
        method="POST">
      Do you like movies? <br/>
        Yes <input type="radio" name="movieCheck" value="yes"/><br/>
        No <input type="radio" name="movieCheck" value="no"/><br/>
      <input type="submit" value="submit"/>
    </form>
  </body>
</html>

Output : output code:

Aucun commentaire:

Enregistrer un commentaire