You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by arne anka <do...@ginguppin.de> on 2008/04/18 15:00:28 UTC
facelets: howto for writing custom components
hi,
after a lot of trial and error, because none of the howtos i found was
complete, i finally figured out how to write a custom component.
but now i need to know, how exactly i do force attributes to be set and,
more important, how i do access components in the body of my component.
ideally these components would be smth like t:commandButton or
t:graphicImage -- how would i render them?
thanks in advance
Re: facelets: howto for writing custom components
Posted by arne anka <do...@ginguppin.de>.
hi,
>> but now i need to know, how exactly i do force attributes to be set
>
> You could simply output some kind of error message if a required value
> is not present.
well, i could, of course, but i thougt there was some kind of mechanism i
only need to hook into ...
>> and, more important, how i do access components in the body of my
>> component.
> Are you probably asking for <ui:insert/> ?
i don't know. do i?
my particular problem at hand is that as result of some method of my bean
i get an object.
this object might be of mime type image/jpeg or text/xml.
so i would like to make a component that renders the object depending on
the mime type -- programatically.
while the xml should be rendered in some kind of datatable the image
should be rendered in some kind of simple image manipulation gui (zoom,
gamma) and thus i need to render the action elements (actionButtons
mostly) with predefined actions.
while i am still want to know how to write my own component at all, for
this particular task i am open for other suggestions as well :-)
thanks
Re: facelets: howto for writing custom components
Posted by Oliver Becker <ob...@obqo.de>.
Hi Arne,
> after a lot of trial and error, because none of the howtos i found
> was complete, i finally figured out how to write a custom component.
> but now i need to know, how exactly i do force attributes to be set
You could simply output some kind of error message if a required value
is not present.
For example within your component:
<h:outputText rendered="#{requiredAttributeName == null}"
styleClass="error" value="your error message" />
> and, more important, how i do access components in the body of my
> component.
> ideally these components would be smth like t:commandButton or
> t:graphicImage -- how would i render them?
Are you probably asking for <ui:insert/> ?
Cheers,
Oliver
Re: facelets: howto for writing custom components
Posted by Matthias Wessendorf <ma...@apache.org>.
Hello
On Fri, Apr 18, 2008 at 3:00 PM, arne anka <do...@ginguppin.de> wrote:
> hi,
> after a lot of trial and error, because none of the howtos i found was
> complete, i finally figured out how to write a custom component.
> but now i need to know, how exactly i do force attributes to be set and,
> more important, how i do access components in the body of my component.
> ideally these components would be smth like t:commandButton or
> t:graphicImage -- how would i render them?
>
>
>
> thanks in advance
here is a simple component described:
http://matthiaswessendorf.wordpress.com/2008/02/29/custom-jsf-components-with-facelets/
>
--
Matthias Wessendorf
further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org