EL_cul_proc.jsp
페이지 정보
본문
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>결과보기 스크립틀릿</h1>
<%
String ex1 = request.getParameter("ex1");
String ex2 = request.getParameter("ex2");
String ex3 = request.getParameter("ex3");
int result = 0;
if(ex2.equals("+")){
result = Integer.parseInt(ex1) + Integer.parseInt(ex3);
}
if(ex2.equals("-")){
result = Integer.parseInt(ex1) - Integer.parseInt(ex3);
}
if(ex2.equals("*")){
result = Integer.parseInt(ex1) * Integer.parseInt(ex3);
}
if(ex2.equals("/")){
result = Integer.parseInt(ex1) / Integer.parseInt(ex3);
}
%>
결과 : <%=result %>
<br>
<br>
<h1>결과보기 EL</h1>
<c:if test="${param.ex2 == '+'}">
${param.ex1 + param.ex3 }
</c:if>
<c:if test="${param.ex2 == '-'}">
${param.ex1 - param.ex3 }
</c:if>
<c:if test="${param.ex2 == '*'}">
${param.ex1 * param.ex3 }
</c:if>
<c:if test="${param.ex2 == '/'}">
${param.ex1 / param.ex3 }
</c:if>
</body>
</html>
- 이전글EL_cul.jsp 21.07.15
- 다음글● JSTL(JSP Standard Tag Library) sql 21.07.15
댓글목록
등록된 댓글이 없습니다.