【发布时间】:2014-12-23 21:39:57
【问题描述】:
我想在 JSTL 中做一个 if 语句。这是我想做的:
<c:set var="sex" value="${param.sex}"/>
<c:if test="$(param.sex=='male')" >
//set the sex to zero
</c:if>
<c:if test="$(param.sex=='female')" >
//set the sex to one
</c:if>
然后像这样在 where 子句中使用性别
<sql:query dataSource="${dbcon}" var="result">
select firstname,lastname from members where sex = ?
<sql:param value="${sex}"></sql:param>
【问题讨论】:
-
继续,什么停止了?忘了问?
-
你的问题是什么?
-
@almasshaikh 我不知道正确的语法
-
我觉得没问题。您认为哪种语法不正确?你试过跑步并有任何异常吗?基本上不做代码审查。