How to port UIComponentBodyTag component to Facelets?

View: New views
10 Messages — Rating Filter:   Alert me  

How to port UIComponentBodyTag component to Facelets?

by Paulo Pinto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody,

I keep advancing with my component porting to Facelets but keep on stumbling
every now and then.

I have a few tags that extend UIComponentBodyTag, these tags have a very strange
behaviour with Facelets. The body of the tag always gets generated by the Facelets
instead of letting the tag do it, as in JSP.

From what I understood so far, does this mean that I have to change my components
to extend a TagHandler so that it regains again control over the body contents?

But the component in question is already extending UICommand.

What is then the best approach?

Thanks,
Paulo

Re: How to port UIComponentBodyTag component to Facelets?

by Andrew Robinson-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

UIComponentBodyTag is a JSP only tag, it will only work in JSP, never
in facelets. To get tag specific functionality and not component, you
have to use a TagHandler. Have a look at the provided JSTL TagHandlers
in facelets for examples on how to write one (like the tag handler for
the c:forEach tag for example)

-Andrew

On Thu, Feb 5, 2009 at 3:10 AM, Paulo Pinto <pjmlp@...> wrote:

> Hi everybody,
>
> I keep advancing with my component porting to Facelets but keep on stumbling
> every now and then.
>
> I have a few tags that extend UIComponentBodyTag, these tags have a very
> strange
> behaviour with Facelets. The body of the tag always gets generated by the
> Facelets
> instead of letting the tag do it, as in JSP.
>
> From what I understood so far, does this mean that I have to change my
> components
> to extend a TagHandler so that it regains again control over the body
> contents?
>
> But the component in question is already extending UICommand.
>
> What is then the best approach?
>
> Thanks,
> Paulo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Parent Message unknown RE: Re: How to port UIComponentBodyTag component to Facelets?

by Raymond K. DeCampo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would add that if your UIComponentBodyTag is not doing anything special, i.e. beyond passing through attributes to the underlying component, it is not necessary to create a TagHandler in Facelets.  Just associate the tag definition to the component and Facelets will match up tag attributes and component attributes automatically.



-----Original Message-----
From: Andrew Robinson [mailto:andrew.rw.robinson@...]
Sent: Thursday, February 05, 2009 10:36
To: users@...
Subject: Re: How to port UIComponentBodyTag component to Facelets?


UIComponentBodyTag is a JSP only tag, it will only work in JSP, never
in facelets. To get tag specific functionality and not component, you
have to use a TagHandler. Have a look at the provided JSTL TagHandlers
in facelets for examples on how to write one (like the tag handler for
the c:forEach tag for example)

-Andrew

On Thu, Feb 5, 2009 at 3:10 AM, Paulo Pinto <pjmlp@...> wrote:

> Hi everybody,
>
> I keep advancing with my component porting to Facelets but keep on stumbling
> every now and then.
>
> I have a few tags that extend UIComponentBodyTag, these tags have a very
> strange
> behaviour with Facelets. The body of the tag always gets generated by the
> Facelets
> instead of letting the tag do it, as in JSP.
>
> From what I understood so far, does this mean that I have to change my
> components
> to extend a TagHandler so that it regains again control over the body
> contents?
>
> But the component in question is already extending UICommand.
>
> What is then the best approach?
>
> Thanks,
> Paulo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Re: How to port UIComponentBodyTag component to Facelets?

by Paulo Pinto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

thanks for the feedback, I am now fighting with a possible solution for the problem.

I know I have to create some kind of handler, but Facelets documentation is scarce how this
is done. The examples provided on the documentation are too basic for what I want to do.

Basically I need to do the following.

<myTag>
   <whatever JSF component />
</myTag>

With the UIComponentBodyTag I was able to get the body of the tag already processed, and suitable to
show on the browser. Thanks to the getBodyContent() method.

But Facelets apparently works in a different way, it seems that I also have to somehow know what to process as
children nodes.

And it is also not clear how I can get all the children with findNextByType().

Any place where I can look for information?

Thanks,
Paulo


On Thu, Feb 5, 2009 at 5:01 PM, Raymond K. DeCampo <rkdecampo@...> wrote:
I would add that if your UIComponentBodyTag is not doing anything special, i.e. beyond passing through attributes to the underlying component, it is not necessary to create a TagHandler in Facelets.  Just associate the tag definition to the component and Facelets will match up tag attributes and component attributes automatically.



-----Original Message-----
From: Andrew Robinson [mailto:andrew.rw.robinson@...]
Sent: Thursday, February 05, 2009 10:36
To: users@...
Subject: Re: How to port UIComponentBodyTag component to Facelets?


UIComponentBodyTag is a JSP only tag, it will only work in JSP, never
in facelets. To get tag specific functionality and not component, you
have to use a TagHandler. Have a look at the provided JSTL TagHandlers
in facelets for examples on how to write one (like the tag handler for
the c:forEach tag for example)

-Andrew

On Thu, Feb 5, 2009 at 3:10 AM, Paulo Pinto <pjmlp@...> wrote:
> Hi everybody,
>
> I keep advancing with my component porting to Facelets but keep on stumbling
> every now and then.
>
> I have a few tags that extend UIComponentBodyTag, these tags have a very
> strange
> behaviour with Facelets. The body of the tag always gets generated by the
> Facelets
> instead of letting the tag do it, as in JSP.
>
> From what I understood so far, does this mean that I have to change my
> components
> to extend a TagHandler so that it regains again control over the body
> contents?
>
> But the component in question is already extending UICommand.
>
> What is then the best approach?
>
> Thanks,
> Paulo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Parent Message unknown RE: Re: Re: How to port UIComponentBodyTag component to Facelets?

by Raymond K. DeCampo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It is not clear to me whether you need the actual body content (in which case a TagHandler would be necessary) or just need access to the children components (in which no extra handler would be needed).
 
-----Original Message-----
From: Paulo Pinto [mailto:pjmlp@...]
Sent: Monday, February 09, 2009 12:12
To: users@...
Subject: Re: Re: How to port UIComponentBodyTag component to Facelets?

Hi,

thanks for the feedback, I am now fighting with a possible solution for the problem.

I know I have to create some kind of handler, but Facelets documentation is scarce how this
is done. The examples provided on the documentation are too basic for what I want to do.

Basically I need to do the following.

<myTag>
   <whatever JSF component />
</myTag>

With the UIComponentBodyTag I was able to get the body of the tag already processed, and suitable to
show on the browser. Thanks to the getBodyContent() method.

But Facelets apparently works in a different way, it seems that I also have to somehow know what to process as
children nodes.

And it is also not clear how I can get all the children with findNextByType().

Any place where I can look for information?

Thanks,
Paulo


On Thu, Feb 5, 2009 at 5:01 PM, Raymond K. DeCampo <rkdecampo@...> wrote:
I would add that if your UIComponentBodyTag is not doing anything special, i.e. beyond passing through attributes to the underlying component, it is not necessary to create a TagHandler in Facelets.  Just associate the tag definition to the component and Facelets will match up tag attributes and component attributes automatically.



-----Original Message-----
From: Andrew Robinson [mailto:andrew.rw.robinson@...]
Sent: Thursday, February 05, 2009 10:36
To: users@...
Subject: Re: How to port UIComponentBodyTag component to Facelets?


UIComponentBodyTag is a JSP only tag, it will only work in JSP, never
in facelets. To get tag specific functionality and not component, you
have to use a TagHandler. Have a look at the provided JSTL TagHandlers
in facelets for examples on how to write one (like the tag handler for
the c:forEach tag for example)

-Andrew

On Thu, Feb 5, 2009 at 3:10 AM, Paulo Pinto <pjmlp@...> wrote:

> Hi everybody,
>
> I keep advancing with my component porting to Facelets but keep on stumbling
> every now and then.
>
> I have a few tags that extend UIComponentBodyTag, these tags have a very
> strange
> behaviour with Facelets. The body of the tag always gets generated by the
> Facelets
> instead of letting the tag do it, as in JSP.
>
> From what I understood so far, does this mean that I have to change my
> components
> to extend a TagHandler so that it regains again control over the body
> contents?
>
> But the component in question is already extending UICommand.
>
> What is then the best approach?
>
> Thanks,
> Paulo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: Re: Re: How to port UIComponentBodyTag component to Facelets?

by Paulo Pinto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I would need to access the already produced HTML.

The idea is the following, this component adds some behaviour to other JSF components that might be nested
as children.

I just need the rendered HTML that the children produce. With JSP based view it is quite easy, just let the JSP
view handler take care of processing the children, when I call getBodyContent(), I will get the HTML without any
extra effort on my part.

When I have the body contents then it is up to me to decide if they get rendered at all, depending on the current
values the tag holds.

Now with facelets I don't have any idea how similar task could be handled, with the same effort as the JSP tag
handler.

All the examples I have found on the web and facelets source code, don't show any proper way of doing this.

Regards,
Paulo

On Mon, Feb 9, 2009 at 7:09 PM, Raymond K. DeCampo <rkdecampo@...> wrote:
It is not clear to me whether you need the actual body content (in which case a TagHandler would be necessary) or just need access to the children components (in which no extra handler would be needed).
 
-----Original Message-----
From: Paulo Pinto [mailto:pjmlp@...]
Sent: Monday, February 09, 2009 12:12
To: users@...
Subject: Re: Re: How to port UIComponentBodyTag component to Facelets?

Hi,

thanks for the feedback, I am now fighting with a possible solution for the problem.

I know I have to create some kind of handler, but Facelets documentation is scarce how this
is done. The examples provided on the documentation are too basic for what I want to do.

Basically I need to do the following.

<myTag>
   <whatever JSF component />
</myTag>

With the UIComponentBodyTag I was able to get the body of the tag already processed, and suitable to
show on the browser. Thanks to the getBodyContent() method.

But Facelets apparently works in a different way, it seems that I also have to somehow know what to process as
children nodes.

And it is also not clear how I can get all the children with findNextByType().

Any place where I can look for information?

Thanks,
Paulo


On Thu, Feb 5, 2009 at 5:01 PM, Raymond K. DeCampo <rkdecampo@...> wrote:
I would add that if your UIComponentBodyTag is not doing anything special, i.e. beyond passing through attributes to the underlying component, it is not necessary to create a TagHandler in Facelets.  Just associate the tag definition to the component and Facelets will match up tag attributes and component attributes automatically.



-----Original Message-----
From: Andrew Robinson [mailto:andrew.rw.robinson@...]
Sent: Thursday, February 05, 2009 10:36
To: users@...
Subject: Re: How to port UIComponentBodyTag component to Facelets?


UIComponentBodyTag is a JSP only tag, it will only work in JSP, never
in facelets. To get tag specific functionality and not component, you
have to use a TagHandler. Have a look at the provided JSTL TagHandlers
in facelets for examples on how to write one (like the tag handler for
the c:forEach tag for example)

-Andrew

On Thu, Feb 5, 2009 at 3:10 AM, Paulo Pinto <pjmlp@...> wrote:

> Hi everybody,
>
> I keep advancing with my component porting to Facelets but keep on stumbling
> every now and then.
>
> I have a few tags that extend UIComponentBodyTag, these tags have a very
> strange
> behaviour with Facelets. The body of the tag always gets generated by the
> Facelets
> instead of letting the tag do it, as in JSP.
>
> From what I understood so far, does this mean that I have to change my
> components
> to extend a TagHandler so that it regains again control over the body
> contents?
>
> But the component in question is already extending UICommand.
>
> What is then the best approach?
>
> Thanks,
> Paulo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...




Re: Re: Re: How to port UIComponentBodyTag component to Facelets?

by Mike Kienenberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There is a MyFaces Tomahawk component called t:buffer that does this.
As far as I know, it doesn't require a custom facelets tag handler to
work with facelets.

http://myfaces.apache.org/tomahawk-project/tomahawk/tagdoc/t_buffer.html

If nothing else, it can serve as example code, even if you don't want
to use it specifically.



On Mon, Feb 9, 2009 at 5:00 PM, Paulo Pinto <pjmlp@...> wrote:

> Hi,
>
> I would need to access the already produced HTML.
>
> The idea is the following, this component adds some behaviour to other JSF
> components that might be nested
> as children.
>
> I just need the rendered HTML that the children produce. With JSP based view
> it is quite easy, just let the JSP
> view handler take care of processing the children, when I call
> getBodyContent(), I will get the HTML without any
> extra effort on my part.
>
> When I have the body contents then it is up to me to decide if they get
> rendered at all, depending on the current
> values the tag holds.
>
> Now with facelets I don't have any idea how similar task could be handled,
> with the same effort as the JSP tag
> handler.
>
> All the examples I have found on the web and facelets source code, don't
> show any proper way of doing this.
>
> Regards,
> Paulo
>
> On Mon, Feb 9, 2009 at 7:09 PM, Raymond K. DeCampo
> <rkdecampo@...> wrote:
>>
>> It is not clear to me whether you need the actual body content (in which
>> case a TagHandler would be necessary) or just need access to the children
>> components (in which no extra handler would be needed).
>>
>>
>> -----Original Message-----
>> From: Paulo Pinto [mailto:pjmlp@...]
>> Sent: Monday, February 09, 2009 12:12
>> To: users@...
>> Subject: Re: Re: How to port UIComponentBodyTag component to Facelets?
>>
>> Hi,
>>
>> thanks for the feedback, I am now fighting with a possible solution for
>> the problem.
>>
>> I know I have to create some kind of handler, but Facelets documentation
>> is scarce how this
>> is done. The examples provided on the documentation are too basic for what
>> I want to do.
>>
>> Basically I need to do the following.
>>
>> <myTag>
>>    <whatever JSF component />
>> </myTag>
>>
>> With the UIComponentBodyTag I was able to get the body of the tag already
>> processed, and suitable to
>> show on the browser. Thanks to the getBodyContent() method.
>>
>> But Facelets apparently works in a different way, it seems that I also
>> have to somehow know what to process as
>> children nodes.
>>
>> And it is also not clear how I can get all the children with
>> findNextByType().
>>
>> Any place where I can look for information?
>>
>> Thanks,
>> Paulo
>>
>>
>> On Thu, Feb 5, 2009 at 5:01 PM, Raymond K. DeCampo
>> <rkdecampo@...> wrote:
>>>
>>> I would add that if your UIComponentBodyTag is not doing anything
>>> special, i.e. beyond passing through attributes to the underlying component,
>>> it is not necessary to create a TagHandler in Facelets.  Just associate the
>>> tag definition to the component and Facelets will match up tag attributes
>>> and component attributes automatically.
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Andrew Robinson [mailto:andrew.rw.robinson@...]
>>> Sent: Thursday, February 05, 2009 10:36
>>> To: users@...
>>> Subject: Re: How to port UIComponentBodyTag component to Facelets?
>>>
>>>
>>> UIComponentBodyTag is a JSP only tag, it will only work in JSP, never
>>> in facelets. To get tag specific functionality and not component, you
>>> have to use a TagHandler. Have a look at the provided JSTL TagHandlers
>>> in facelets for examples on how to write one (like the tag handler for
>>> the c:forEach tag for example)
>>>
>>> -Andrew
>>>
>>> On Thu, Feb 5, 2009 at 3:10 AM, Paulo Pinto <pjmlp@...> wrote:
>>> > Hi everybody,
>>> >
>>> > I keep advancing with my component porting to Facelets but keep on
>>> > stumbling
>>> > every now and then.
>>> >
>>> > I have a few tags that extend UIComponentBodyTag, these tags have a
>>> > very
>>> > strange
>>> > behaviour with Facelets. The body of the tag always gets generated by
>>> > the
>>> > Facelets
>>> > instead of letting the tag do it, as in JSP.
>>> >
>>> > From what I understood so far, does this mean that I have to change my
>>> > components
>>> > to extend a TagHandler so that it regains again control over the body
>>> > contents?
>>> >
>>> > But the component in question is already extending UICommand.
>>> >
>>> > What is then the best approach?
>>> >
>>> > Thanks,
>>> > Paulo
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Parent Message unknown RE: Re: Re: Re: How to port UIComponentBodyTag component to Facelets?

by Raymond K. DeCampo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Interesting.  My understanding of the way the JSP view handler works is inconsistent with what you described.  But I'm not exactly an expert there.  Which version/implementation of JSF were you working with?
 
In any case, it seems to me that this behavior should be coded in the component itself, in the UIComponent.encodeChildren() method (or perhaps in its renderer in the Renderer.encodeChildren() method).  You could pass a wrapped FacesContext to the children to capture the output of their encoding.  Such a solution would work no matter what the ViewHandler is.
 

-----Original Message-----
From: Paulo Pinto [mailto:pjmlp@...]
Sent: Monday, February 09, 2009 17:01
To: users@...
Subject: Re: Re: Re: How to port UIComponentBodyTag component to Facelets?

Hi,

I would need to access the already produced HTML.

The idea is the following, this component adds some behaviour to other JSF components that might be nested
as children.

I just need the rendered HTML that the children produce. With JSP based view it is quite easy, just let the JSP
view handler take care of processing the children, when I call getBodyContent(), I will get the HTML without any
extra effort on my part.

When I have the body contents then it is up to me to decide if they get rendered at all, depending on the current
values the tag holds.

Now with facelets I don't have any idea how similar task could be handled, with the same effort as the JSP tag
handler.

All the examples I have found on the web and facelets source code, don't show any proper way of doing this.

Regards,
Paulo

On Mon, Feb 9, 2009 at 7:09 PM, Raymond K. DeCampo <rkdecampo@...> wrote:
It is not clear to me whether you need the actual body content (in which case a TagHandler would be necessary) or just need access to the children components (in which no extra handler would be needed).
 
-----Original Message-----
From: Paulo Pinto [mailto:pjmlp@...]
Sent: Monday, February 09, 2009 12:12
To: users@...
Subject: Re: Re: How to port UIComponentBodyTag component to Facelets?

Hi,

thanks for the feedback, I am now fighting with a possible solution for the problem.

I know I have to create some kind of handler, but Facelets documentation is scarce how this
is done. The examples provided on the documentation are too basic for what I want to do.

Basically I need to do the following.

<myTag>
   <whatever JSF component />
</myTag>

With the UIComponentBodyTag I was able to get the body of the tag already processed, and suitable to
show on the browser. Thanks to the getBodyContent() method.

But Facelets apparently works in a different way, it seems that I also have to somehow know what to process as
children nodes.

And it is also not clear how I can get all the children with findNextByType().

Any place where I can look for information?

Thanks,
Paulo


On Thu, Feb 5, 2009 at 5:01 PM, Raymond K. DeCampo <rkdecampo@...> wrote:
I would add that if your UIComponentBodyTag is not doing anything special, i.e. beyond passing through attributes to the underlying component, it is not necessary to create a TagHandler in Facelets.  Just associate the tag definition to the component and Facelets will match up tag attributes and component attributes automatically.



-----Original Message-----
From: Andrew Robinson [mailto:andrew.rw.robinson@...]
Sent: Thursday, February 05, 2009 10:36
To: users@...
Subject: Re: How to port UIComponentBodyTag component to Facelets?


UIComponentBodyTag is a JSP only tag, it will only work in JSP, never
in facelets. To get tag specific functionality and not component, you
have to use a TagHandler. Have a look at the provided JSTL TagHandlers
in facelets for examples on how to write one (like the tag handler for
the c:forEach tag for example)

-Andrew

On Thu, Feb 5, 2009 at 3:10 AM, Paulo Pinto <pjmlp@...> wrote:

> Hi everybody,
>
> I keep advancing with my component porting to Facelets but keep on stumbling
> every now and then.
>
> I have a few tags that extend UIComponentBodyTag, these tags have a very
> strange
> behaviour with Facelets. The body of the tag always gets generated by the
> Facelets
> instead of letting the tag do it, as in JSP.
>
> From what I understood so far, does this mean that I have to change my
> components
> to extend a TagHandler so that it regains again control over the body
> contents?
>
> But the component in question is already extending UICommand.
>
> What is then the best approach?
>
> Thanks,
> Paulo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...




Re: Re: Re: How to port UIComponentBodyTag component to Facelets?

by Paulo Pinto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, I will have a lookt at it.

On Mon, Feb 9, 2009 at 11:12 PM, Mike Kienenberger <mkienenb@...> wrote:
There is a MyFaces Tomahawk component called t:buffer that does this.
As far as I know, it doesn't require a custom facelets tag handler to
work with facelets.

http://myfaces.apache.org/tomahawk-project/tomahawk/tagdoc/t_buffer.html

If nothing else, it can serve as example code, even if you don't want
to use it specifically.



On Mon, Feb 9, 2009 at 5:00 PM, Paulo Pinto <pjmlp@...> wrote:
> Hi,
>
> I would need to access the already produced HTML.
>
> The idea is the following, this component adds some behaviour to other JSF
> components that might be nested
> as children.
>
> I just need the rendered HTML that the children produce. With JSP based view
> it is quite easy, just let the JSP
> view handler take care of processing the children, when I call
> getBodyContent(), I will get the HTML without any
> extra effort on my part.
>
> When I have the body contents then it is up to me to decide if they get
> rendered at all, depending on the current
> values the tag holds.
>
> Now with facelets I don't have any idea how similar task could be handled,
> with the same effort as the JSP tag
> handler.
>
> All the examples I have found on the web and facelets source code, don't
> show any proper way of doing this.
>
> Regards,
> Paulo
>
> On Mon, Feb 9, 2009 at 7:09 PM, Raymond K. DeCampo
> <rkdecampo@...> wrote:
>>
>> It is not clear to me whether you need the actual body content (in which
>> case a TagHandler would be necessary) or just need access to the children
>> components (in which no extra handler would be needed).
>>
>>
>> -----Original Message-----
>> From: Paulo Pinto [mailto:pjmlp@...]
>> Sent: Monday, February 09, 2009 12:12
>> To: users@...
>> Subject: Re: Re: How to port UIComponentBodyTag component to Facelets?
>>
>> Hi,
>>
>> thanks for the feedback, I am now fighting with a possible solution for
>> the problem.
>>
>> I know I have to create some kind of handler, but Facelets documentation
>> is scarce how this
>> is done. The examples provided on the documentation are too basic for what
>> I want to do.
>>
>> Basically I need to do the following.
>>
>> <myTag>
>>    <whatever JSF component />
>> </myTag>
>>
>> With the UIComponentBodyTag I was able to get the body of the tag already
>> processed, and suitable to
>> show on the browser. Thanks to the getBodyContent() method.
>>
>> But Facelets apparently works in a different way, it seems that I also
>> have to somehow know what to process as
>> children nodes.
>>
>> And it is also not clear how I can get all the children with
>> findNextByType().
>>
>> Any place where I can look for information?
>>
>> Thanks,
>> Paulo
>>
>>
>> On Thu, Feb 5, 2009 at 5:01 PM, Raymond K. DeCampo
>> <rkdecampo@...> wrote:
>>>
>>> I would add that if your UIComponentBodyTag is not doing anything
>>> special, i.e. beyond passing through attributes to the underlying component,
>>> it is not necessary to create a TagHandler in Facelets.  Just associate the
>>> tag definition to the component and Facelets will match up tag attributes
>>> and component attributes automatically.
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Andrew Robinson [mailto:andrew.rw.robinson@...]
>>> Sent: Thursday, February 05, 2009 10:36
>>> To: users@...
>>> Subject: Re: How to port UIComponentBodyTag component to Facelets?
>>>
>>>
>>> UIComponentBodyTag is a JSP only tag, it will only work in JSP, never
>>> in facelets. To get tag specific functionality and not component, you
>>> have to use a TagHandler. Have a look at the provided JSTL TagHandlers
>>> in facelets for examples on how to write one (like the tag handler for
>>> the c:forEach tag for example)
>>>
>>> -Andrew
>>>
>>> On Thu, Feb 5, 2009 at 3:10 AM, Paulo Pinto <pjmlp@...> wrote:
>>> > Hi everybody,
>>> >
>>> > I keep advancing with my component porting to Facelets but keep on
>>> > stumbling
>>> > every now and then.
>>> >
>>> > I have a few tags that extend UIComponentBodyTag, these tags have a
>>> > very
>>> > strange
>>> > behaviour with Facelets. The body of the tag always gets generated by
>>> > the
>>> > Facelets
>>> > instead of letting the tag do it, as in JSP.
>>> >
>>> > From what I understood so far, does this mean that I have to change my
>>> > components
>>> > to extend a TagHandler so that it regains again control over the body
>>> > contents?
>>> >
>>> > But the component in question is already extending UICommand.
>>> >
>>> > What is then the best approach?
>>> >
>>> > Thanks,
>>> > Paulo
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: Re: Re: Re: How to port UIComponentBodyTag component to Facelets?

by Paulo Pinto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This was developed with JSF 1.1.

The component is a simple panel like component, and is divided in the standard trio, Component, Renderer and Tag set.

The tag gets the generated output from its children, by using getBodyContent() and stores it into the component. When the renderer gets to generate the HTML, it will show the children's output only if the panel is in expanded state.

Regards,
Paulo

On Mon, Feb 9, 2009 at 11:14 PM, Raymond K. DeCampo <rkdecampo@...> wrote:
Interesting.  My understanding of the way the JSP view handler works is inconsistent with what you described.  But I'm not exactly an expert there.  Which version/implementation of JSF were you working with?
 
In any case, it seems to me that this behavior should be coded in the component itself, in the UIComponent.encodeChildren() method (or perhaps in its renderer in the Renderer.encodeChildren() method).  You could pass a wrapped FacesContext to the children to capture the output of their encoding.  Such a solution would work no matter what the ViewHandler is.
 

-----Original Message-----
From: Paulo Pinto [mailto:pjmlp@...]
Sent: Monday, February 09, 2009 17:01
To: users@...
Subject: Re: Re: Re: How to port UIComponentBodyTag component to Facelets?

Hi,

I would need to access the already produced HTML.

The idea is the following, this component adds some behaviour to other JSF components that might be nested
as children.

I just need the rendered HTML that the children produce. With JSP based view it is quite easy, just let the JSP
view handler take care of processing the children, when I call getBodyContent(), I will get the HTML without any
extra effort on my part.

When I have the body contents then it is up to me to decide if they get rendered at all, depending on the current
values the tag holds.

Now with facelets I don't have any idea how similar task could be handled, with the same effort as the JSP tag
handler.

All the examples I have found on the web and facelets source code, don't show any proper way of doing this.

Regards,
Paulo

On Mon, Feb 9, 2009 at 7:09 PM, Raymond K. DeCampo <rkdecampo@...> wrote:
It is not clear to me whether you need the actual body content (in which case a TagHandler would be necessary) or just need access to the children components (in which no extra handler would be needed).
 
-----Original Message-----
From: Paulo Pinto [mailto:pjmlp@...]
Sent: Monday, February 09, 2009 12:12
To: users@...
Subject: Re: Re: How to port UIComponentBodyTag component to Facelets?

Hi,

thanks for the feedback, I am now fighting with a possible solution for the problem.

I know I have to create some kind of handler, but Facelets documentation is scarce how this
is done. The examples provided on the documentation are too basic for what I want to do.

Basically I need to do the following.

<myTag>
   <whatever JSF component />
</myTag>

With the UIComponentBodyTag I was able to get the body of the tag already processed, and suitable to
show on the browser. Thanks to the getBodyContent() method.

But Facelets apparently works in a different way, it seems that I also have to somehow know what to process as
children nodes.

And it is also not clear how I can get all the children with findNextByType().

Any place where I can look for information?

Thanks,
Paulo


On Thu, Feb 5, 2009 at 5:01 PM, Raymond K. DeCampo <rkdecampo@...> wrote:
I would add that if your UIComponentBodyTag is not doing anything special, i.e. beyond passing through attributes to the underlying component, it is not necessary to create a TagHandler in Facelets.  Just associate the tag definition to the component and Facelets will match up tag attributes and component attributes automatically.



-----Original Message-----
From: Andrew Robinson [mailto:andrew.rw.robinson@...]
Sent: Thursday, February 05, 2009 10:36
To: users@...
Subject: Re: How to port UIComponentBodyTag component to Facelets?


UIComponentBodyTag is a JSP only tag, it will only work in JSP, never
in facelets. To get tag specific functionality and not component, you
have to use a TagHandler. Have a look at the provided JSTL TagHandlers
in facelets for examples on how to write one (like the tag handler for
the c:forEach tag for example)

-Andrew

On Thu, Feb 5, 2009 at 3:10 AM, Paulo Pinto <pjmlp@...> wrote:

> Hi everybody,
>
> I keep advancing with my component porting to Facelets but keep on stumbling
> every now and then.
>
> I have a few tags that extend UIComponentBodyTag, these tags have a very
> strange
> behaviour with Facelets. The body of the tag always gets generated by the
> Facelets
> instead of letting the tag do it, as in JSP.
>
> From what I understood so far, does this mean that I have to change my
> components
> to extend a TagHandler so that it regains again control over the body
> contents?
>
> But the component in question is already extending UICommand.
>
> What is then the best approach?
>
> Thanks,
> Paulo
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...