Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp 比较<;c:如果>;_Jsp_Arraylist_Jstl - Fatal编程技术网

Jsp 比较<;c:如果>;

Jsp 比较<;c:如果>;,jsp,arraylist,jstl,Jsp,Arraylist,Jstl,我需要循环遍历与数据库列相关的特定行列表,该列的类型为Integer。数据库中的此列是同一表中父列ID的外键 我必须匹配这两个值,如果存在匹配,则在JSP中打印 我已经通过了这个链接,并一直试图让它工作。我不知道到底哪里出了问题 以下是我到目前为止的情况: <c:forEach var="List" items="${Section.LangList}"> <c:if test="${List['Lang'] == List['Id']}"> ..

我需要循环遍历与数据库列相关的特定行列表,该列的类型为
Integer
。数据库中的此列是同一表中父列ID的外键

我必须匹配这两个值,如果存在匹配,则在JSP中打印

我已经通过了这个链接,并一直试图让它工作。我不知道到底哪里出了问题

以下是我到目前为止的情况:

<c:forEach var="List" items="${Section.LangList}">
    <c:if test="${List['Lang'] == List['Id']}">
        ...
    </c:if> 
</c:forEach>    

...

这是我用来比较这些值的东西之一。我试过
包含
,也试过
。有什么我遗漏的吗?

试试这样的方法:

<c:forEach var="item" items="${Section.LangList}">                   
    <c:if test="${item.lang eq item.id}">
        .....
    </c:if>
</c:forEach>    

.....

如果它不起作用,请向我们显示迭代列表中的类

您需要以小写字母开始属性名称。
${Section.LangList}
不起作用,它必须是
${Sections.LangList}

<c:forEach var="List" items="${Section.langList}">
    <c:if test="${List['Lang'] == List['Id']}">
        ...
    </c:if> 
</c:forEach> 
我仍然想知道
${language.lang}
在这种情况下有什么意义。

我缺少什么:包括列表中包含的对象类的代码。
<c:forEach var="language" items="${section.languages}">
    <c:if test="${language.lang == language.id}">
        ...
    </c:if> 
</c:forEach>