Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.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页面上的JSTL标记不起作用,在HTML页面源代码中看起来很简单_Jsp_Jstl - Fatal编程技术网

JSP页面上的JSTL标记不起作用,在HTML页面源代码中看起来很简单

JSP页面上的JSTL标记不起作用,在HTML页面源代码中看起来很简单,jsp,jstl,Jsp,Jstl,我一直在努力寻找代码中的问题,但我看不到它 在我的servlet中,我创建了一个国家列表,并将其设置到我的请求中: List<Country> countryList = (new CountryListForm(countryDAO)).getList(); request.setAttribute(ATTRIBUTE_COUNTRY_LIST, countryList); List countryList=(新的CountryListForm(countryDAO)).getL

我一直在努力寻找代码中的问题,但我看不到它

在我的servlet中,我创建了一个国家列表,并将其设置到我的请求中:

List<Country> countryList = (new CountryListForm(countryDAO)).getList();
request.setAttribute(ATTRIBUTE_COUNTRY_LIST, countryList);
List countryList=(新的CountryListForm(countryDAO)).getList();
setAttribute(属性\国家\列表,国家列表);
调试servlet时,我看到创建了国家列表并将其放入请求中

接下来,在我的JSP中,我获取国家列表,遍历它并在下拉列表中显示值:

        <select id="clubCountryId" name="clubCountryId">
            <c:forEach var="country" items="${countryList}">
                <option value="${country.id}">
                    ${fn:escapeXml(country.name)}
                </option>
            </c:forEach>
        </select>

${fn:escapeXml(country.name)}
当我调试这个程序时,我可以看到countryList在我的请求中,并且这些国家都存在。但是,我的下拉列表中没有任何内容。当我查看页面的源代码(在Eclipse中)时,我会看到以下内容:

        <select id="clubCountryId" name="clubCountryId">
            <c:forEach var="country" items="[eu.ctt.pojo.Country@c7057c, eu.ctt.pojo.Country@391da0, eu.ctt.pojo.Country@1c7f37d, eu.ctt.pojo.Country@42a6eb, eu.ctt.pojo.Country@1dcc4cd]">
                <option value="">

                </option>
            </c:forEach>
        </select>

正如您所看到的,我的五个对象都存在,但它只是不想对它们进行迭代。我有其他页面,我基本上做同样的事情(国家列表,但不是下拉列表),我没有问题

有人有什么建议吗


提前谢谢

JSTL标记出现在HTML源代码中,这是不对的。它应该在服务器端运行,并在HTML输出中完全消失。如果没有在JSP顶部声明标记库,则可能会发生这种情况。在JSP顶部添加以下行以运行JSTL核心标记:


如果这反过来导致投诉服务器日志中缺少TLD URI,则需要确保已安装。也许您正在运行一个没有JSTL内置的容器,比如Tomcat或Jetty

另见:

谢谢你,巴卢斯克。这就是我们所缺少的。我已经在我的其他网页上看到了。多么愚蠢的错误!再次感谢!