JS输出JSTL

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" import="java.util.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="./js/jquery-1.9.1.min.js"></script>
</head>
<body>
<%
List list = new ArrayList();
list.add("11");
list.add("22");
list.add("33");
list.add("45");
request.setAttribute("list", list);
%>
<div id="test">

</div>

</body>

</html>
<script language="javascript">
$(function(){
$("#test").html("<select><c:forEach items='${list}' var='l'>}<option value='${l }'>${l }</option></c:forEach></select>");
});
</script>

posted @ 2013-04-11 15:34  七郎  Views(2857)  Comments(0Edit  收藏  举报