Hi Alan,
I'n not an expert by any means, but I have not come across <f:converter> tag
that allows anything other than the id. I think if you want to pass
parameters, you couls try something along the lines of :
<f:converter converterId="GwOutTextConverter">
   <f:param id="substring" value="5" />
</f:converter>

Then in your converter you can access the parameters from the Request
Parameter map which you can get a hold of from the faces context.
Hope that helps


Alan Gross wrote:
> 
> HI Forum
> 
> Environment info:
> Tomcat6
> Myfaces 1.2.2
> Facelets 1.1.13
> 
> I'm tring to write a flexibel string converter. The goal is to have a
> converter that provides the following functionality
> - substring
> - remove newlines
> 
> I would like to pass the parameters by attributes
> - number of chars for substring
> - number of newlines before truncating
> 
> I took the standard converter DateTimeConverter as an example. But for
> some reason I don't get it to work.
> 
> I think the problem is that the "restoreState" method is never invoked
> here. Also the "getAsObject" method is never invoked..? Don't know if
> necessary? I tried to use server and client state saving method. Read it
> could have an impact..?
> 
> Does anyone have experience with passing parameters to converters? 
> 
> Any help is appreciated. Thank you!
> Alan
> 
> Attached you find the following files:
> - faces-config.xml
> - web.xml
> - OutputTextConverter.java
>  http://www.nabble.com/file/p17351134/OutputTextConverter.java
> OutputTextConverter.java 
>  http://www.nabble.com/file/p17351134/faces-config.xml faces-config.xml 
>  http://www.nabble.com/file/p17351134/web.xml web.xml 
> 
> Here is an extract of the page:
> <h:outputText  value="#{newsVar.description}"  escape="false">
> <f:converter converterId="GwOutTextConverter" substring="5" maxNewLine="3"
> test="123"/>
> </h:outputText>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Converter---Problem-passing-attributes-tp17351134p17365037.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to