You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stefan Esterer <de...@gmail.com> on 2009/06/04 10:04:17 UTC

[T 5.1] Problem with: Block parameters are only allowed directly within component elements

Hi List...

I just switched from Tapestry 5.0.18 to Tapestry 5.1.0.5 and I'm
experiencing a problem with the IF component. 
I'm not quite sure if this is a bug or feature, so please enlighten me *g*

For demonstration I just use the tutorial IF example
(http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/If.html). 
It looks like this

<t:if test="user">
            Welcome back, ${user.firstName}
            <p:else>
                <t:pagelink name="login">Login</t:pagelink> /
                <t:pagelink name="register">Register</t:pagelink>
            </p:else>
</t:if>

This works perfectly fine. Only if I add a additional <div> I get a problem.

<t:if test="user">
            Welcome back, ${user.firstName}
            <div>
                  <p:else>
                     <t:pagelink name="login">Login</t:pagelink> /
                     <t:pagelink name="register">Register</t:pagelink>
                 </p:else>
            </div>
</t:if>

Using the template with the additional <div> I get this exception:

java.lang.RuntimeException
Block parameters are only allowed directly within component elements.

Is this a design decision or a bug?

Thx for your help
Stefan Esterer
-- 
View this message in context: http://www.nabble.com/-T-5.1--Problem-with%3A-Block-parameters-are-only-allowed-directly-within-component-elements-tp23865519p23865519.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [T 5.1] Problem with: Block parameters are only allowed directly within component elements

Posted by Howard Lewis Ship <hl...@gmail.com>.
Too much noise here; that should read

"in your example, the <div> will *always* rfender empty and only if
the user is not null in 5.0."

On Thu, Jun 4, 2009 at 11:18 AM, Howard Lewis Ship <hl...@gmail.com> wrote:
> What Tapestry is doing now in 5.1 is correct.  In you example, the
> <div> will *always* render empty, and only if user is null in 5.0. 5.1
> forces you to put the <p:else> where it makes sense.  The Tapestry 5.0
> documentation should have been more specific, that you place it
> *directly* inside the body of the component (not merely somehwhere
> inside).
>
> On Thu, Jun 4, 2009 at 6:29 AM, Geoffrey Wiseman
> <ge...@gmail.com> wrote:
>> On Thu, Jun 4, 2009 at 4:04 AM, Stefan Esterer <de...@gmail.com> wrote:
>>
>>> This works perfectly fine. Only if I add a additional <div> I get a
>>> problem.
>>>
>>> <t:if test="user">
>>>            Welcome back, ${user.firstName}
>>>            <div>
>>>                  <p:else>
>>>                     <t:pagelink name="login">Login</t:pagelink> /
>>>                     <t:pagelink name="register">Register</t:pagelink>
>>>                 </p:else>
>>>            </div>
>>> </t:if>
>>>
>>
>>
>> Why would you do that, just for previewability?  That structure doesn't make
>> a ton of sense to me.  If there's a user, should tapestry render:
>>
>>> Welcome back, Stefan Esterer<div></div>
>>>
>>
>> And if there's no user:
>>
>>> <a href="login">Login</a> / <a href="register">Register</a>
>>>
>>
>> I'm curious for the people who are getting bitten by this what they have in
>> mind.
>>
>>  - Geoffrey
>> --
>> Geoffrey Wiseman
>> http://www.geoffreywiseman.ca/
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
> Director of Open Source Technology at Formos
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

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


Re: [T 5.1] Problem with: Block parameters are only allowed directly within component elements

Posted by Howard Lewis Ship <hl...@gmail.com>.
What Tapestry is doing now in 5.1 is correct.  In you example, the
<div> will *always* render empty, and only if user is null in 5.0. 5.1
forces you to put the <p:else> where it makes sense.  The Tapestry 5.0
documentation should have been more specific, that you place it
*directly* inside the body of the component (not merely somehwhere
inside).

On Thu, Jun 4, 2009 at 6:29 AM, Geoffrey Wiseman
<ge...@gmail.com> wrote:
> On Thu, Jun 4, 2009 at 4:04 AM, Stefan Esterer <de...@gmail.com> wrote:
>
>> This works perfectly fine. Only if I add a additional <div> I get a
>> problem.
>>
>> <t:if test="user">
>>            Welcome back, ${user.firstName}
>>            <div>
>>                  <p:else>
>>                     <t:pagelink name="login">Login</t:pagelink> /
>>                     <t:pagelink name="register">Register</t:pagelink>
>>                 </p:else>
>>            </div>
>> </t:if>
>>
>
>
> Why would you do that, just for previewability?  That structure doesn't make
> a ton of sense to me.  If there's a user, should tapestry render:
>
>> Welcome back, Stefan Esterer<div></div>
>>
>
> And if there's no user:
>
>> <a href="login">Login</a> / <a href="register">Register</a>
>>
>
> I'm curious for the people who are getting bitten by this what they have in
> mind.
>
>  - Geoffrey
> --
> Geoffrey Wiseman
> http://www.geoffreywiseman.ca/
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

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


Re: [T 5.1] Problem with: Block parameters are only allowed directly within component elements

Posted by Geoffrey Wiseman <ge...@gmail.com>.
On Thu, Jun 4, 2009 at 4:04 AM, Stefan Esterer <de...@gmail.com> wrote:

> This works perfectly fine. Only if I add a additional <div> I get a
> problem.
>
> <t:if test="user">
>            Welcome back, ${user.firstName}
>            <div>
>                  <p:else>
>                     <t:pagelink name="login">Login</t:pagelink> /
>                     <t:pagelink name="register">Register</t:pagelink>
>                 </p:else>
>            </div>
> </t:if>
>


Why would you do that, just for previewability?  That structure doesn't make
a ton of sense to me.  If there's a user, should tapestry render:

> Welcome back, Stefan Esterer<div></div>
>

And if there's no user:

> <a href="login">Login</a> / <a href="register">Register</a>
>

I'm curious for the people who are getting bitten by this what they have in
mind.

  - Geoffrey
-- 
Geoffrey Wiseman
http://www.geoffreywiseman.ca/

Re: [T 5.1] Problem with: Block parameters are only allowed directly within component elements

Posted by DH <ni...@gmail.com>.
Refer https://issues.apache.org/jira/browse/TAP5-571.

I've put my comment on this fixing too. I think the fixing is not so perfect.

DH

----- Original Message ----- 
From: "Stefan Esterer" Sent: Thursday, June 04, 2009 4:04 PM
Subject: [T 5.1] Problem with: Block parameters are only allowed directly within component elements


> 
> Hi List...
> 
> I just switched from Tapestry 5.0.18 to Tapestry 5.1.0.5 and I'm
> experiencing a problem with the IF component. 
> I'm not quite sure if this is a bug or feature, so please enlighten me *g*
> 
> For demonstration I just use the tutorial IF example
> (http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/If.html). 
> It looks like this
> 
> <t:if test="user">
>            Welcome back, ${user.firstName}
>            <p:else>
>                <t:pagelink name="login">Login</t:pagelink> /
>                <t:pagelink name="register">Register</t:pagelink>
>            </p:else>
> </t:if>
> 
> This works perfectly fine. Only if I add a additional <div> I get a problem.
> 
> <t:if test="user">
>            Welcome back, ${user.firstName}
>            <div>
>                  <p:else>
>                     <t:pagelink name="login">Login</t:pagelink> /
>                     <t:pagelink name="register">Register</t:pagelink>
>                 </p:else>
>            </div>
> </t:if>
> 
> Using the template with the additional <div> I get this exception:
> 
> java.lang.RuntimeException
> Block parameters are only allowed directly within component elements.
> 
> Is this a design decision or a bug?
> 
> Thx for your help
> Stefan Esterer
> -- 
> View this message in context: http://www.nabble.com/-T-5.1--Problem-with%3A-Block-parameters-are-only-allowed-directly-within-component-elements-tp23865519p23865519.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>