2-9自由编程
来源:2-9 自由编程
RobinZang
2019-09-28 12:24:03
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <% request.setAttribute("day", "abc"); %> <!-- choose when otherwise --> ${day } <c:choose> <c:when test="${day == 'MONDAY'}"> <h2 style="color: blue">星期一</h2> </c:when> <c:when test="${day == 'TUESDAY'}"> <h2 style="color: blue">星期二</h2> </c:when> <c:when test="${day == 'WEDNESDAY'}"> <h2 style="color: blue">星期三</h2> </c:when> <c:when test="${day == 'THURSDAY'}"> <h2 style="color: blue">星期四</h2> </c:when> <c:when test="${day == 'FRIDAY'}"> <h2 style="color: blue">星期五</h2> </c:when> <c:when test="${day == 'SATURDAY'}"> <h2 style="color: blue">星期六</h2> </c:when> <c:when test="${day == 'SUNDAY'}"> <h2 style="color: blue">星期日</h2> </c:when> <c:otherwise> <h2 style="color: red">内容不对呦!</h2> </c:otherwise> </c:choose> </body> </html>
1回答
好帮手慕小班
2019-09-28
同学完成的不错,很棒哦,加油!祝学习愉快~
相似问题