Hi,
I'm trying to display an attribute value of ArrayList from JSP set in session scope in servlet as:
hs.setAttribute("Attr",arr); //where hs is reference to HttpSession and arr is of type of ArrayList
But when I invoked simple tag with the EL expression as optionList attribute value of advice tag in JSP as:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="mine" uri="DiceFunctions" %>
<html><body>
<mine:advice optionList='${sessionScope.Attr}' />
</body></html>
I displayed nothing.
The code of Simple tag handler is:
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;
}
}
and TLD, which is set in WEB-INF folder is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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">
<tlib-version>1.2</tlib-version>
<jsp-version>1.2</jsp-version>
<uri>DiceFunctions</uri>
<tag>
<name>advice</name>
<tag-class>foo.AdvisorTagHandler</tag-class>
<body-content>empty</body-content>
<attribute>
<name>optionList</name>
<type>java.util.List</type>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
What's wrong I'm doing? How can I display the value of ArrayList object?
Thanks in advance.