请用JSTL中的写一段代码用于在JSP中的显示输出
[quote]写一段代码用于在JSP中的显示输出 [/quote]
[size=large]
[color=red]下面是代码....list是在页面显示前的action的方法里用request.setAttribute("list",list);设置的.[/color][/size]
/c:out
/c:if
</c:forEach>
[size=x-large][color=indigo]希望对你有帮助[/color][/size]
下面代码是一个简单的/c:if标记的使用演示,其作用是显示URL链接中名为name的参数值。
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>JSTL If</h1>
<c:if test="${param.name != null}">
<!-- 欢迎用户 ${param.name} -->
Hello ${param.name}!
</c:if>
</body>