您如何使用JSTL? [英] How do you use JSTL?

查看:89
本文介绍了您如何使用JSTL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用JSTL,但存在以下问题:

Trying to use JSTL but have the following problem:

Index.xhtml页面:

Index.xhtml page:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:jsp="http://java.sun.com/JSP/Page">
<body>
<c:out value="Hello world!"/>
</body></html>

POM:

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

输出源:

        <html id="document:html" lang="en" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:jsp="http://java.sun.com/JSP/Page"><head><meta content="Rendered by ICEFaces D2D" name="icefaces" />
.....
    <c:out value="Hello world!"></c:out>
....</body></html>

您可以看到它不处理c:out,而只是将其打印为文本.

As you can see its not processing the c:out but just printing it out as text.

推荐答案

似乎:

解决方案是从jstl名称空间中删除/jsp:

The solution is to remove the /jsp from the jstl namespace:

xmlns:c ="http://java.sun.com/jstl/core"

xmlns:c="http://java.sun.com/jstl/core"

请参见此帖子.

这篇关于您如何使用JSTL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆