| Author |
Passing Objects to a Tag File
|
Frederic Filiatrault
Ranch Hand
Joined: Jul 12, 2004
Posts: 69
|
|
Hi there, Think I'm confusing few things. Can you help me out ? It is possible to configure attributes for tag Files, like this example : ------------------------------------------------------------------- (Demo.tag) ------------------------------------------------------------------- <%@ tag body-content="scriptless"%> <%@ attribute name="test" required="true" type="java.util.Vector"%> There is : <%=test.size()%> element(s). ------------------------------------------------------------------- ------------------------------------------------------------------- (Demo.jsp) ------------------------------------------------------------------- <%@ taglib tagdir="/WEB-INF/tags" prefix="t"%> <!Vector list = new Vector();%> <t emo test="list"/> ------------------------------------------------------------------- There is the error. Any idea? org.apache.jasper.JasperException: jsp.error.beans.property.conversion org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885) org.apache.jsp.Demo_jsp._jspx_meth_t_Demo_0(Demo_jsp.java:74) org.apache.jsp.Demo_jsp._jspService(Demo_jsp.java:51) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
|
 |
Frederic Filiatrault
Ranch Hand
Joined: Jul 12, 2004
Posts: 69
|
|
Hi again, I found it out ! <t emo test="<%=list%>"/> Ok. Now, why ?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
[Aside: be sure to click the 'disable smilies' checkbox when posting code]
<t:demo test="list"/>
In the above, "list" is a string.
<t:demo test="<%=list%>"/>
In this, "list" is a referenc to the class-level scripting variable (ugh!) that you created. You get the error in the first case because a String cannot be converted to a Vector. [ July 22, 2004: Message edited by: Bear Bibeault ] [ July 22, 2004: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Frederic Filiatrault
Ranch Hand
Joined: Jul 12, 2004
Posts: 69
|
|
|
thk !
|
 |
 |
|
|
subject: Passing Objects to a Tag File
|
|
|