aspose file tools*
The moose likes JSP and the fly likes Passing Objects to a Tag File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing Objects to a Tag File" Watch "Passing Objects to a Tag File" New topic
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 !

<temo test="<%=list%>"/>

Ok. Now, why ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

[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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Frederic Filiatrault
Ranch Hand

Joined: Jul 12, 2004
Posts: 69
thk !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing Objects to a Tag File