首页 > 这段代码什么意思,html里面java代码?

这段代码什么意思,html里面java代码?

<ul class="clear">
                        <c:forEach var="item" items="${slotSite }">
                        <li class="${ item.flat eq  code ?  'active': '' }">
                            <c:choose>
                                <c:when test="${item.flat eq 'bbin' }">
                                    <c:choose>
                                        <c:when test="${!empty webUser}">
                                            <a
                                                onclick="winOpen('${ctx}/forwardGame?gameType=bbin&pageSite=game',window.screen.width,window.screen.height,0,0,'game','bbin');return false;"
                                                href="javascript:void(0);" target="_blank" class="block">
                                        </c:when>
                                        <c:otherwise>
                                            <a href="javascript:void(0);"
                                                onclick="alert('您尚未登录,请先登录再进行游戏')" class="block">
                                        </c:otherwise>
                                    </c:choose>BBIN电游</a>
                                </c:when>
                                
                                ***<c:when test="${item.flat  eq 'ag'}">***
                                    <c:choose>
                                        <c:when test="${!empty webUser}">
                                            <a
                                                onclick="winOpen('${ctx}/forwardGame?gameType=ag&agGameType=2',window.screen.width,window.screen.height,0,0,'game','ag');return false;"
                                                href="javascript:void(0);" class="block" target="_blank">
                                        </c:when>
                                        <c:otherwise>
                                            <a href="javascript:void(0);"
                                                onclick="alert('您尚未登录,请先登录再进行游戏')" class="block">
                                        </c:otherwise>
                                    </c:choose>AG电游</a>
                                </c:when>
                                
                                <c:otherwise>
                                    <a href="${ctx}/${item.flatUrl}" class="block">${item.flatName }</a>
                                </c:otherwise>
                            </c:choose>
                        </li>
                        </c:forEach>
                    </ul>

里面的<c:otherwise></c:choose></c:forEach> <c:when test="${item.flat eq 'bbin' }">啥意思?


循环
    判断
    再判断
结束循环

JSTL语法


<c:otherwise> 字面意思,否则
</c:choose> 和when 搭配,用于多种情况的不同处理方法
</c:forEach>遍历变量,一般这样的情况,表示后台传的是一个数组对象
<c:when test="${item.flat eq 'bbin' }" 表示test里的判断环境,item对象的flat属性,值是bbin为true的话,那么执行下面的操作


JSTL标签,后端返回页面时,会将数据带至前端页面上,展示在相应位置。


这是后端模板引擎所解析的代码,属于JSTL。不属于HTML范畴,在后端处理页面是,会根据这些代码进行渲染,之后这些代码会消失,输出到前端会没有的。


JSTL,写在jsp里面的,可以参考教程


页面文件是不是有<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

【热门文章】
【热门文章】