Custom converter in JSF 2 with arguments

后端 未结 4 1071
一生所求
一生所求 2020-12-14 20:54

I\'m trying to implement a custom truncate converter, which truncates a string at a given index and adds a continuation symbol. The converter works fine, only when i hard co

4条回答
  •  爱一瞬间的悲伤
    2020-12-14 21:30

    You may take a look at JSF2.0 sources. For example DateTimeConverter... JSF sources available here in svn reposotory: https://svn.java.net/svn/mojarra~svn/trunk

    IMO creating such converter is not easy. It also required to create converter tag to register converter.

    Other way to pass some data to converter is attibutes. So You can write

    
      
      
    
    

    Than call to component.getAttributes().get("truncateIndex"); in converter code.

提交回复
热议问题