You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jose Gonzalez Gomez <jg...@gmail.com> on 2005/01/03 17:28:35 UTC

Parameter not bound while rewinding

Hi there,

I have a parameter of a component (named listener) that gets correctly
bounded while showing the page, but I cannot access it while the page
is rewinding. Here is the related code:

[MyPage.java]
  public void myListener( IRequestCycle cycle )
    { ... some code here... }

[MyPage.jwc]
    <component id="info" type="MyComponent">
        ... other parameters ...
        <binding name="listener" expression="listeners.myListener"/>
    </component>

[MyComponent.jwc]
    <parameter name="listener" direction="in"
type="org.apache.tapestry.IActionListener" required="no"/>
    <component id="nestedInfo" type="NestedComponent">
        ... other parameters ...
        <binding name="listener" expression="listener"/>
    </component>

[NestedComponent.jwc]
    <parameter name="listener" direction="in"
type="org.apache.tapestry.IActionListener" required="no"/>

When I do a submit on the page, the parameter is no longer bounded
although I have been able to access to the binding object, get the
listener and call it with the following code in NestedComponent.java:

    IActionListener listener = (IActionListener)
this.getListenerBinding( ).getObject( );
    listener.actionTriggered( this, cycle );

Why am I not able to access the listener parameter directly while the
page is rewinding? What am I missing?

Thanks in advance, best regards
Jose

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


Re: Parameter not bound while rewinding

Posted by Howard Lewis Ship <hl...@gmail.com>.
ActionLink isn't deprecated, they won't let me!

You can use "in" parameters in a listener method for an ActionLink,
because ActionLink (and the action service) do a full render of the
page (just like Form does a partial render of its body).

My objection to ActionLink is that the links expose quite a bit of the
internal structure of your app, making them very short lived.  This is
true of DirectLink and Form as well (to lesser degrees).

Unlike Form (which has Hidden, ListEdit, etc.) there aren't any tools
for ActionLink for dealing with the browser back button, or other
problems related to mismatched state on the client and server. Thus,
at most, I would only use ActionLink for prototyping.

I never actually use ActionLink in any of my applications.  To me,
ActionLink is a misstep, nearly five years ago, that I can't seem to
get rid of.


On Mon, 3 Jan 2005 19:57:43 +0100, Vjeran Marcinko <vj...@tis.hr> wrote:
> Hi Howard,
> Speaking of having to put "auto" parameter, is it needed only when using
> DirectLink or also case with ActionLink ?
> And what was the reason for deprecating ActionLink anyway ? If rewind phase
> was the reason, why it's still acceptable in Form component?
> 
> Regards,
> Vjeran
> 
> ----- Original Message -----
> From: "Howard Lewis Ship" <hl...@gmail.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>; "Jose Gonzalez
> Gomez" <jg...@gmail.com>
> Sent: Monday, January 03, 2005 7:53 PM
> Subject: Re: Parameter not bound while rewinding
> 
> If you access a parameter from within a listener method in Tapestry
> 3.0, then the parameter must be direction "auto", not direction "in".
> 
> In Tapestry 3.1, you won't have to worry about this; parameter
> direction simply doesn't exist and it works during render and rewind
> (i.e., inside a listener method).
> 
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.298 / Virus Database: 265.6.6 - Release Date: 28.12.2004
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Parameter not bound while rewinding

Posted by Vjeran Marcinko <vj...@tis.hr>.
Hi Howard,
Speaking of having to put "auto" parameter, is it needed only when using
DirectLink or also case with ActionLink ?
And what was the reason for deprecating ActionLink anyway ? If rewind phase
was the reason, why it's still acceptable in Form component?

Regards,
Vjeran

----- Original Message ----- 
From: "Howard Lewis Ship" <hl...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>; "Jose Gonzalez
Gomez" <jg...@gmail.com>
Sent: Monday, January 03, 2005 7:53 PM
Subject: Re: Parameter not bound while rewinding


If you access a parameter from within a listener method in Tapestry
3.0, then the parameter must be direction "auto", not direction "in".

In Tapestry 3.1, you won't have to worry about this; parameter
direction simply doesn't exist and it works during render and rewind
(i.e., inside a listener method).



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.6 - Release Date: 28.12.2004


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


Re: Parameter not bound while rewinding

Posted by Howard Lewis Ship <hl...@gmail.com>.
If you access a parameter from within a listener method in Tapestry
3.0, then the parameter must be direction "auto", not direction "in".

In Tapestry 3.1, you won't have to worry about this; parameter
direction simply doesn't exist and it works during render and rewind
(i.e., inside a listener method).


On Mon, 3 Jan 2005 18:17:06 +0100, Jose Gonzalez Gomez
<jg...@gmail.com> wrote:
> That's one of the things I thought about, but I took a look at some
> Tapestry standard components, and they seem to follow the same schema.
> For example, in the Submit component:
> 
> [Submit.jwc]
>   <parameter name="listener"
>         type="org.apache.tapestry.IActionListener"
>         direction="in"/>
> 
> [Submit.java]
>     protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
>     {
>         IForm form = getForm(cycle);
>         boolean rewinding = form.isRewinding();
>         String name = form.getElementId(this);
> 
>         if (rewinding)
>         {
>             [.........]
>             IActionListener listener = getListener();
> 
>             if (listener != null)
>                 listener.actionTriggered(this, cycle);
> 
>             return;
>         }
>         [.........]
>     }
> 
> The place where I access the listener parameter in my NestedComponent
> should be called inside the renderComponent method of the parent class
> (BaseComponent), so what's the difference with my code? The only thing
> I can think of it's that my components aren't included inside a
> form... does that make a difference?
> 
> Best regards
> Jose
> 
> On Mon, 03 Jan 2005 17:47:02 +0100, Julio C. Rivera <ju...@ya.com> wrote:
> > I think it's a parameter direction issue.
> > I think you only can access a "in" paramenter at render time.
> >
> > Try
> >  ...
> >  <parameter name="listener" direction="auto"
> >  ...
> >
> > Please, see tapestry documentation:
> > http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/components.parameters.html
> >
> > Best regards.
> >
> > Julio.
> >
> > El lun, 03-01-2005 a las 17:28, Jose Gonzalez Gomez escribió:
> > > Hi there,
> > >
> > > I have a parameter of a component (named listener) that gets correctly
> > > bounded while showing the page, but I cannot access it while the page
> > > is rewinding. Here is the related code:
> > >
> > > [MyPage.java]
> > >   public void myListener( IRequestCycle cycle )
> > >     { ... some code here... }
> > >
> > > [MyPage.jwc]
> > >     <component id="info" type="MyComponent">
> > >         ... other parameters ...
> > >         <binding name="listener" expression="listeners.myListener"/>
> > >     </component>
> > >
> > > [MyComponent.jwc]
> > >     <parameter name="listener" direction="in"
> > > type="org.apache.tapestry.IActionListener" required="no"/>
> > >     <component id="nestedInfo" type="NestedComponent">
> > >         ... other parameters ...
> > >         <binding name="listener" expression="listener"/>
> > >     </component>
> > >
> > > [NestedComponent.jwc]
> > >     <parameter name="listener" direction="in"
> > > type="org.apache.tapestry.IActionListener" required="no"/>
> > >
> > > When I do a submit on the page, the parameter is no longer bounded
> > > although I have been able to access to the binding object, get the
> > > listener and call it with the following code in NestedComponent.java:
> > >
> > >     IActionListener listener = (IActionListener)
> > > this.getListenerBinding( ).getObject( );
> > >     listener.actionTriggered( this, cycle );
> > >
> > > Why am I not able to access the listener parameter directly while the
> > > page is rewinding? What am I missing?
> > >
> > > Thanks in advance, best regards
> > > Jose
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Parameter not bound while rewinding

Posted by Jose Gonzalez Gomez <jg...@gmail.com>.
That's one of the things I thought about, but I took a look at some
Tapestry standard components, and they seem to follow the same schema.
For example, in the Submit component:

[Submit.jwc]
  <parameter name="listener" 
  	type="org.apache.tapestry.IActionListener"
  	direction="in"/>

[Submit.java]
    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);
        boolean rewinding = form.isRewinding();
        String name = form.getElementId(this);

        if (rewinding)
        {
            [.........]
            IActionListener listener = getListener();

            if (listener != null)
                listener.actionTriggered(this, cycle);

            return;
        }
        [.........]
    }

The place where I access the listener parameter in my NestedComponent
should be called inside the renderComponent method of the parent class
(BaseComponent), so what's the difference with my code? The only thing
I can think of it's that my components aren't included inside a
form... does that make a difference?

Best regards
Jose

On Mon, 03 Jan 2005 17:47:02 +0100, Julio C. Rivera <ju...@ya.com> wrote:
> I think it's a parameter direction issue.
> I think you only can access a "in" paramenter at render time.
> 
> Try
>  ...
>  <parameter name="listener" direction="auto"
>  ...
> 
> Please, see tapestry documentation:
> http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/components.parameters.html
> 
> Best regards.
> 
> Julio.
> 
> El lun, 03-01-2005 a las 17:28, Jose Gonzalez Gomez escribió:
> > Hi there,
> >
> > I have a parameter of a component (named listener) that gets correctly
> > bounded while showing the page, but I cannot access it while the page
> > is rewinding. Here is the related code:
> >
> > [MyPage.java]
> >   public void myListener( IRequestCycle cycle )
> >     { ... some code here... }
> >
> > [MyPage.jwc]
> >     <component id="info" type="MyComponent">
> >         ... other parameters ...
> >         <binding name="listener" expression="listeners.myListener"/>
> >     </component>
> >
> > [MyComponent.jwc]
> >     <parameter name="listener" direction="in"
> > type="org.apache.tapestry.IActionListener" required="no"/>
> >     <component id="nestedInfo" type="NestedComponent">
> >         ... other parameters ...
> >         <binding name="listener" expression="listener"/>
> >     </component>
> >
> > [NestedComponent.jwc]
> >     <parameter name="listener" direction="in"
> > type="org.apache.tapestry.IActionListener" required="no"/>
> >
> > When I do a submit on the page, the parameter is no longer bounded
> > although I have been able to access to the binding object, get the
> > listener and call it with the following code in NestedComponent.java:
> >
> >     IActionListener listener = (IActionListener)
> > this.getListenerBinding( ).getObject( );
> >     listener.actionTriggered( this, cycle );
> >
> > Why am I not able to access the listener parameter directly while the
> > page is rewinding? What am I missing?
> >
> > Thanks in advance, best regards
> > Jose
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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


Re: Parameter not bound while rewinding

Posted by Mikaël Cluseau <nw...@nwrk.dyndns.org>.
Le lundi 03 janvier 2005 à 14:01 -0500, Howard Lewis Ship a écrit :
> In Tapestry 3.1, parameter direction is gone and they just work.  I'm
> looking forward to a 3.1 beta, at which point I can stop talking about
> component parameter direction!
> 

Hey Howard, we're all looking for a Tapestry 3.1 beta to migrate all our
apps ;-)

Thanks a lot for Tapestry and HiveMind, really, I love it more each time
I understand it more...

(where is the "I love Tapestry" list ? :-))

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


Re: Parameter not bound while rewinding

Posted by Howard Lewis Ship <hl...@gmail.com>.
In Tapestry 3.1, parameter direction is gone and they just work.  I'm
looking forward to a 3.1 beta, at which point I can stop talking about
component parameter direction!


On Mon, 03 Jan 2005 17:47:02 +0100, Julio C. Rivera <ju...@ya.com> wrote:
> I think it's a parameter direction issue.
> I think you only can access a "in" paramenter at render time.
> 
> Try
>  ...
>  <parameter name="listener" direction="auto"
>  ...
> 
> Please, see tapestry documentation:
> http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/components.parameters.html
> 
> Best regards.
> 
> Julio.
> 
> El lun, 03-01-2005 a las 17:28, Jose Gonzalez Gomez escribió:
> > Hi there,
> >
> > I have a parameter of a component (named listener) that gets correctly
> > bounded while showing the page, but I cannot access it while the page
> > is rewinding. Here is the related code:
> >
> > [MyPage.java]
> >   public void myListener( IRequestCycle cycle )
> >     { ... some code here... }
> >
> > [MyPage.jwc]
> >     <component id="info" type="MyComponent">
> >         ... other parameters ...
> >         <binding name="listener" expression="listeners.myListener"/>
> >     </component>
> >
> > [MyComponent.jwc]
> >     <parameter name="listener" direction="in"
> > type="org.apache.tapestry.IActionListener" required="no"/>
> >     <component id="nestedInfo" type="NestedComponent">
> >         ... other parameters ...
> >         <binding name="listener" expression="listener"/>
> >     </component>
> >
> > [NestedComponent.jwc]
> >     <parameter name="listener" direction="in"
> > type="org.apache.tapestry.IActionListener" required="no"/>
> >
> > When I do a submit on the page, the parameter is no longer bounded
> > although I have been able to access to the binding object, get the
> > listener and call it with the following code in NestedComponent.java:
> >
> >     IActionListener listener = (IActionListener)
> > this.getListenerBinding( ).getObject( );
> >     listener.actionTriggered( this, cycle );
> >
> > Why am I not able to access the listener parameter directly while the
> > page is rewinding? What am I missing?
> >
> > Thanks in advance, best regards
> > Jose
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Parameter not bound while rewinding

Posted by "Julio C. Rivera" <ju...@ya.com>.
I think it's a parameter direction issue. 
I think you only can access a "in" paramenter at render time.

Try
 ...
 <parameter name="listener" direction="auto" 
 ...

Please, see tapestry documentation:
http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/components.parameters.html

Best regards.

Julio.

El lun, 03-01-2005 a las 17:28, Jose Gonzalez Gomez escribió:
> Hi there,
> 
> I have a parameter of a component (named listener) that gets correctly
> bounded while showing the page, but I cannot access it while the page
> is rewinding. Here is the related code:
> 
> [MyPage.java]
>   public void myListener( IRequestCycle cycle )
>     { ... some code here... }
> 
> [MyPage.jwc]
>     <component id="info" type="MyComponent">
>         ... other parameters ...
>         <binding name="listener" expression="listeners.myListener"/>
>     </component>
> 
> [MyComponent.jwc]
>     <parameter name="listener" direction="in"
> type="org.apache.tapestry.IActionListener" required="no"/>
>     <component id="nestedInfo" type="NestedComponent">
>         ... other parameters ...
>         <binding name="listener" expression="listener"/>
>     </component>
> 
> [NestedComponent.jwc]
>     <parameter name="listener" direction="in"
> type="org.apache.tapestry.IActionListener" required="no"/>
> 
> When I do a submit on the page, the parameter is no longer bounded
> although I have been able to access to the binding object, get the
> listener and call it with the following code in NestedComponent.java:
> 
>     IActionListener listener = (IActionListener)
> this.getListenerBinding( ).getObject( );
>     listener.actionTriggered( this, cycle );
> 
> Why am I not able to access the listener parameter directly while the
> page is rewinding? What am I missing?
> 
> Thanks in advance, best regards
> Jose
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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