I am looking at the ComponentHandler.java from Facelets 1.1.14 and I
see no meta rules for converter. This means that converter="#{}" would
be set without any type of special handling. So:
<my:component value="foo" converter="contentConverter" />
Is definitely nod valid syntax. The converter must evaluate to a
converter instance, not a converter ID:
public void setConverter(Converter converter) {...}
So you have to use EL:
<my:component value="foo" converter="#{bean_that_implements_converter}" />
I do not know why this doesn't work though:
<f:converter converterId="contentConverter"/>
That is handled by com.sun.facelets.tag.jsf.ConvertHandler
The only requirement is that the parent component of the tag must
implement ValueHolder, which UIOutput does.
It creates the converter using:
return ctx.getFacesContext().getApplication().createConverter(this.converterId);
If you are using facelets 1.1.14 and have verified your taglib.xml
files are correct, then I would advise you to debug into the facelets
code for the classes that I have mentioned and see what is going on
first hand.
You can also try calling this manually from a bean somewhere and
making sure it works:
FacesContext.getCurrentInstance().getApplication().createConverter("contentConverter");
-Andrew
On Thu, Apr 24, 2008 at 2:43 AM, arne anka <[EMAIL PROTECTED]> wrote:
> thought, i mentioned it already -- there is no xhtml involved. i try to do
> it entirely in java:
>
> public class FedoraObjectContentComponentUI extends UIOutput
> {
> private byte[] myObject = null;
> private String myMime, myDS, myID;
>
> @Override
> public String getFamily()
> {
> return "fedoraobjectcontent";
> }
>
> @Override
> public String getRendererType()
> {
> return null;
> }
>
> @Override
> public void encodeBegin(FacesContext context) throws IOException
> {
> super.encodeBegin(context);
> final ResponseWriter writer = context.getResponseWriter();
> writer.write("<br/>Foo</br>");
> }
>
> @Override
> public Object saveState(FacesContext context)
> {
> Object values[] = new Object[5];
> values[0] = super.saveState(context);
> values[1] = myObject;
> values[2] = myMime;
> values[3] = myDS;
> values[4] = myID;
> return ((Object) (values));
> }
>
> @Override
> public void restoreState(FacesContext context, Object state)
> {
> Object values[] = (Object[]) state;
> super.restoreState(context, values[0]);
> myObject = (byte[]) values[1];
> myMime = (String) values[2];
> myDS = (String) values[3];
> myID = (String) values[4];
> }
> }
>
> and in faces-config.xml
>
> <component>
> <component-type>component</component-type>
>
> <component-class>my.package.Components.FedoraObjectContentComponentUI</component-class>
> </component>
>
> that's my component, basically.
>
>
>
> On Wed, 23 Apr 2008 19:52:21 +0200, Andrew Robinson
> <[EMAIL PROTECTED]> wrote:
>
>
> > I should have asked this earlier, what is my:component? Do you use
> > ui:component in the root of the xhtml file? Is there getConverter /
> > setConverter methods on the component?
> >
> > If you could provide a small code snippet from the facelet and the
> > component that it uses that would help.
> >
> > -Andrew
> >
> > On Wed, Apr 23, 2008 at 11:31 AM, arne anka <[EMAIL PROTECTED]> wrote:
> >
> > > snippet from faces-config.xml:
> > > <converter>
> > > <description>
> > > </description>
> > > <display-name>contentConverter</display-name>
> > > <converter-id>contentConverter</converter-id>
> > >
> > >
> <converter-class>my.package.FaceletsElements.FedoraObjectContentConverter</converter-class>
> > > </converter>
> > >
> > > as said before -- it works with standard components. so it seems to be
> > > something trivial i do not see.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Wed, 23 Apr 2008 19:21:37 +0200, Andrew Robinson
> > > <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > > Have you registered the converter in faces-config.xml properly? Please
> > > > post your configuration for your converter
> > > >
> > > > On Wed, Apr 23, 2008 at 7:20 AM, arne anka <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > hi,
> > > > > i got my custom component (faclets based, not tomahawk or trinidad,
> > > > > extending UIOutput) working so far -- but my converter is not
> executed.
> > > > > if i attribute the converter to, say, h:outputText it works, so it
> > > seems to
> > > > > be ok.
> > > > > my idea is, because i use my own rendere (getRendererType() returns
> > > null)
> > > > > maybe i need to call it myself?
> > > > > if so, how do i get hold of the converter?
> > > > >
> > > > > both with
> > > > >
> > > > > <my:component value="foo" converter="contentConverter" />
> > > > >
> > > > > and with
> > > > >
> > > > > <my:component value="foo">
> > > > > <f:converter converterId="contentConverter"/>
> > > > > </my:component>
> > > > >
> > > > > getConverter() always returns null
> > > > >
> > > > > thanks in advance
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > >
> >
>
>
>