我想创建一个jsp页面,这样我就可以计算学生的成绩。
我有一个jsp页面,我可以在其中选择学生姓名并输入主题标记。
eg:
<table>
<tr>
<td>Student name</td><td><select><option value="">Pooja</option><option value="">Rani</option></select>
<td>Subject <select><option value="" selected >Maths</select>
<td>Mark</td>
<td><input type="text ></td></tr>
<tr><td>Student name</td><td><select><option value="">Pooja</option><option value="">Rani</option></select>
<td>Subject <select><option value="" selected >English</option></select>
<td>Mark</td><td><input type="text ></td></tr>
</table>现在如何创建一个逻辑条件,如果Pooja的英语分数是80分,数学分数是80分,那么只有成绩是B。我的意思是如何动态地创建if条件。alos如何在前端添加逻辑运算符
发布于 2015-12-08 18:45:03
使用JSTL库。
<c:if test="${grade gt 80}">
//your code here
</c:if>发布于 2015-12-08 18:44:48
您可以在jsp中使用条件语句,如下所示:
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<html>
<head>
<title>Java Code Geeks Snippets - Condition Content in JSP Page</title>
</head>
<body>
<%
if ("myvalue".equals(request.getParameter("myparam"))) {
%>
This will be printed if parameter myparam equals with myvalue
<%
}
else {
%>
This will be printed if parameter myparam DOES NOT equal with myvalue
<%
}
%>
</body>https://stackoverflow.com/questions/34153711
复制相似问题