>From: "Lindholm, Greg" <[EMAIL PROTECTED]>
>
> Hello Massimiliano,
>
> You need you write a custom tag, you can't do it with
> the f:converter tag.
>
 
You could also bind the target component to a managed bean and manually register a converter.  Then you could use transparent attributes on the component to pass on to the converter.  A custom tag would be the better approach.
 
<h:outputText value="#{obj.id}" binding="obj.idCmp">
    <f:attribute name="custom" value="#{obj.custom}"/>
 </h:outputText>

The custom attribute would be added to the component.
 
private HtmlOutputText idCmp = null;
 
public HtmlOutputText getIdCmp() {
   if (idCmp == null) {
       idCmp = new HtmlOutputText();
   }
  
   if (idCmp.getConverter() == null) {
       MyConverter converter = new MyConverter();
       converter.setCustom((String) idCmp.getAttributes("custom"));
       idCmp.setConverter(converter);
   }
   
}
 
public void setIdCmp(HtmlOutputText id).....
 
 
 
Gary

> If you look at this thread it's got source code for creating
> a custom tag for a converter.
>
> You will need to pay attention to when the attributes from
> the tag get evaluated (when the valueBinding getValue() occurs).
> The example shown will evaluate the attributes when the
> converter is created. Further down the thread there is
> a discussion of how to evaluate the attributes when the
> converter getAsString() is called.
>
> http://thread.gmane.org/gmane.comp.jakarta.myfaces.user/17632/focus=1781
> 9
>
>
> Greg
>
> -----Original Message-----
> From: Massimiliano Cantoni [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 18, 2006 11:58 AM
> To: [email protected]
> Subject: Converter with parameters
>
> I am trying to develop an application using Myfaces and now I am facing
> t his pr oblem:
>
> I am trying to develop a custom converter using the converter tag.
> To be more concrete I am trying to convert the name of a document given
> the id.
> Unfortunately the name of the document is not depending only on the id
> but also on another customization number and
> I do not know how to pass it to the converter.
>
> I tried the following
>
>
>
>
>

>

>
> But unfortunately it says that converter must be empty according to TLD.
>
> I tried also the follwing
>
>
>
>

>
> and tried to get custom from MyConverter code without any success.
>
> Am I using the correct approach?
>
> Can someone point me on the right direction?
>
> JSF newbie but not too much
>
> --
> ------------------------------------------
> Cantoni Massimiliano
>
> CED Assicom S.p.a.
> email: [EMAIL PROTECTED]
> Indirizzo: Via De Cocule 33030 BUIA(UD)
> Telefono: 0432/9683
> ------------------------------------------
>

Reply via email to