File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Can't Pass object to custom tag attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Can Watch "Can New topic

Can't Pass object to custom tag attribute

Milo Timbol

Joined: Oct 25, 2011
Posts: 1

I get this error when i try to pass an object in the custom tags attribute.

[show] /signmodule/campaign/signsList.jsp:14: expected '<%= ... %>' at '#{signsBean.folderTreeDataModel}'
for tag attribute setter 'setDataModel(com.jscape.framework.galileo.components.treemodel.BaseTreeDataModel)'.
Tag attributes which can't be converted from strings must use a runtime
attribute expression.

13: <body style="margin-left:12px;">
14: <sample:hello dataModel="#{signsBean.folderTreeDataModel}" />
15: </body>
16: </html>

Here's my Code

TLD file

This is the old code that worked. It used a different tree component that we are trying to replace.

The closest related topic I found on the internet is this one

They were talking about resin settings (changes in web.xml) which I tried to but didnt work. Do you guys know how to solve this?

Im running resin 3.2.1.

Thanks in advance.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

Please be sure to ask JSF questions in the JSF forum. I have moved this post there for you.

[Asking smart questions] [About Bear] [Books by Bear]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17416

Welcome to the Ranch, Milo!

I suspect that your primary problem is that this view isn't being routed through the FacesServlet and the stock JSP processor didn't like your JSF-style EL.

A bigger issue, however, is that I seriously doubt that a standard JSP custom tag is going to work at all well on a JSF View definition. While JSF may have started out from a JSP perspective, it has diverged considerably since then. And done so in so messy a manner that I always caution people to try to avoid developing binary-level custom JSF tags and instead use Facelets xthml tag definitions or similar mechanisms wherever possible. Among other things, a proper JSF custom tag has to be set up to allow a plug-in rendering engine, and not the "brute force" simple scheme that ordinary JSPs do.

On the plus side, however, there are a number of JSF extension tagsets that come with their own tree controls already debugged and ready to use. Not to mention tons of other useful control types.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Can't Pass object to custom tag attribute
It's not a secret anymore!