本文共 1124 字,大约阅读时间需要 3 分钟。
1编写处理类:
public class ListTest { public static List2配置tld文件:getList(String string){ List list=null; if("a".equals(string)){ list=new ArrayList (Arrays.asList("aa","bb","cc","dd")); return list; }else{ list=new ArrayList (Arrays.asList("AA","BB","CC","DD")); return list; } }}
3 jsp中使用:JSTL 1.1 functions library JSTL functions sys 1.1 fns http://java.sun.com/jsp/jstl/functionss 获取字典对象列表 getList com.smart.shiro.ListTest java.util.List getList(java.lang.String)
<%@ page contentType="text/html;charset=UTF-8" language="java" %><%@ taglib prefix="fnss" uri="/WEB-INF/fns.tld" %><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%@ page isELIgnored="false" %>Title <% request.setAttribute("aaa","a");%>${ fnss:getList(aaa)}
[aa, bb, cc, dd]
转载地址:http://iljqi.baihongyu.com/