<c:forEach items="${list}" var="mylist">
<td ><a href="novel!read.action?url=${mylist.chapterurl}&chapter=<%=URLEncoder.encode(string, "utf-8") %>${mylist.chapter}" >${mylist.chapter}</a></td>
</c:forEach>怎么把${mylist.chapter}传到string中去?

解决方案 »

  1.   

    foaEacher 遍历的时候,是把遍历出来的对象放在pageContext对象中的
    假设Chapter 就是你List集合里面的对象 , 那么得到该对象的chapter属性的方法如下:
    <%= ((Chapter)pageContext.getAttribute("mylist")).getChapter()%>
      

  2.   


    tld<?xml version="1.0" encoding="UTF-8" ?><taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0"> <description>自定义EL标签</description>
    <display-name>el function</display-name>
    <tlib-version>1.1</tlib-version>
    <short-name>n</short-name>
    <uri>http://xxx.com/jsp/jstl/xxx</uri>
    <function>
    <description>功能名称</description>
    <name>frmUrl</name>
    <function-class>com.xxx.xxx.util.类名</function-class>
    <function-signature>java.lang.String 方法名(java.lang.String--参数)</function-signature>
    <example>${xxx:frmUrl(url)}自定义EL名字</example>
    </function>
    </taglib>java
    public static String 方法名(String str)
    {}web.xml<taglib>
     <taglib-uri>http://xxx.xxx.com/jsp/jstl/xxx</taglib-uri>
     <taglib-location>/WEB-INF/tld/xxx.tld</taglib-location>
    </taglib>jsp
    <a href="/abc/${xxx:frmUrl(str)}/ccc/"></a>