Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple tag not able to intrepret session scope attribute
    primarykey
    data
    text
    <p>I'm trying to display an attribute value of <strong>ArrayList</strong> from JSP set in session scope in servlet as:</p> <pre><code> hs.setAttribute("Attr",arr); //where hs is reference to HttpSession and arr is of type of ArrayList </code></pre> <p>But when I invoked simple tag with the EL expression as <strong>optionList</strong> attribute value of advice tag in JSP as:</p> <pre><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; &lt;%@ taglib prefix="mine" uri="DiceFunctions" %&gt; &lt;html&gt;&lt;body&gt; &lt;mine:advice optionList='${sessionScope.Attr}' /&gt; &lt;/body&gt;&lt;/html&gt; </code></pre> <p>I displayed nothing.</p> <p>The code of Simple tag handler is:</p> <pre><code>package foo; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.*; import java.io.*; import javax.servlet.jsp.*; import java.util.*; public class AdvisorTagHandler extends SimpleTagSupport{ String name; String size; ArrayList option; public void doTag() throws JspException,IOException{ JspWriter out=getJspContext().getOut(); for(Object o: option) { out.print(out.toString()); } public void setOptionList(List value) { option=(ArrayList)value; } } </code></pre> <p>and TLD, which is set in WEB-INF folder is:</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;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/web-jsptaglibrary_2_0.xsd" version="2.0"&gt; &lt;tlib-version&gt;1.2&lt;/tlib-version&gt; &lt;jsp-version&gt;1.2&lt;/jsp-version&gt; &lt;uri&gt;DiceFunctions&lt;/uri&gt; &lt;tag&gt; &lt;name&gt;advice&lt;/name&gt; &lt;tag-class&gt;foo.AdvisorTagHandler&lt;/tag-class&gt; &lt;body-content&gt;empty&lt;/body-content&gt; &lt;attribute&gt; &lt;name&gt;optionList&lt;/name&gt; &lt;type&gt;java.util.List&lt;/type&gt; &lt;required&gt;false&lt;/required&gt; &lt;rtexprvalue&gt;true&lt;/rtexprvalue&gt; &lt;/attribute&gt; &lt;/tag&gt; &lt;/taglib&gt; </code></pre> <p>What's wrong I'm doing? How can I display the value of ArrayList object?</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload