You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by João Paulo Vasconcellos <va...@gmail.com> on 2005/02/23 20:59:15 UTC

Rewind of Form problem

Hello list,

  I think I have a newbie problem, but as I cannot find anything like
this on Google...

  I have a form with three PropertySelection components, one of then
with submitOnChange=true.

  When I submit with the OnChange, the page complains like this:

You have clicked on a stale link.

Rewind of form FaleConosco/$Form expected only 1 form elements, but an
additional id was requested by component FaleConosco/cArea.

This is most likely the result of using your browser's back button,
but can also be an application error.

You may continue by returning to the application's home page.

Now I'm stuck with this. I have no idea of what is happening and
cannot find info on the web.
Hope someone can shed a light on this.

Code involved:

FaleConosco.html

<html jwcid="@Shell" title="Fale Conosco">
    <body>
        <span jwcid="@Conditional" condition="ognl:message">
            <font color="red">
                <span jwcid="@Insert" value="ognl:message">
                    Mensagem de Erro
                </span>
            </font>
        </span>
        <p/>
        <form jwcid="@Form" listener="ognl:listeners.enviaEmail">
            Rela&ccedil;&atilde;o com a Dix:
            <span jwcid="cRelacaoDix"/>
            <br>
            <span jwcid="@Conditional" condition="ognl:relacaoDix">
                <span jwcid="@Insert" value="ognl:textoCampoLogin" /> <br />
                Relação com a Dix: <span jwcid="@Insert"
value="ognl:relacaoDix" /> <br />
                &Aacute;rea respons&aacute;vel: <span jwcid="cArea"/> <br />
                Assunto: <span jwcid="cAssunto"/> <br />
                
            </span>

        </form>
    </body>
</html>


FaleConosco.page

<?xml version="1.0"?>

<!DOCTYPE page-specification PUBLIC
    "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

<page-specification class="web.FaleConosco">
    <property-specification name="message" type="java.lang.String"/>
    <property-specification name="relacaoDix" type="java.lang.String"/>
    <property-specification name="matricula" type="java.lang.String"/>
    <property-specification name="assunto" type="java.lang.String"/>
    <property-specification name="area" type="java.lang.String"/>
    <property-specification name="mensagem" type="java.lang.String"/>
    <property-specification name="textoCampoLogin" type="java.lang.String"/>
    
    <component id="cRelacaoDix" type="PropertySelection">
        <binding name="model" expression="@web.FaleConosco@cbRelacaoDix"/>
        <binding name="value" expression="relacaoDix"/>
        <binding name="submitOnChange" expression="true"/>
    </component>

    <component id="cArea" type="PropertySelection">
        <binding name="model" expression="@web.FaleConosco@cbArea"/>
        <binding name="value" expression="area"/>
        <binding name="submitOnChange" expression="false"/>
    </component>

    <component id="cAssunto" type="PropertySelection">
        <binding name="model" expression="@web.FaleConosco@cbAssunto"/>
        <binding name="value" expression="assunto"/>
        <binding name="submitOnChange" expression="false"/>
    </component>

    
</page-specification>


FaleConosco.java

package web;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.form.StringPropertySelectionModel;

//import org.apache.tapestry.event.PageRenderListener;

public abstract class FaleConosco extends BasePage {
    
    public static final IPropertySelectionModel cbRelacaoDix =
            new StringPropertySelectionModel( new String[] {
                "Selecione", "Cliente", "Credenciado", "Corretor",
"Visitante" } );
    
    public static final IPropertySelectionModel cbAssunto =
            new StringPropertySelectionModel( new String[] {
                "Selecione", "Sugestão", "Reclamação", "Elogio" } );
    
    public static final IPropertySelectionModel cbArea =
            new StringPropertySelectionModel( new String[] {
                "Selecione", "DixAmico", "Área Médica", "Comercial",
"Marketing",
                "Financeiro", "Dúvidas com a senha" } );
    
    public abstract String getMatricula();
    public abstract void setMatricula(String matricula);
    
    public abstract String getMensagem();
    public abstract void setMensagem(String mensagem);
    
    public abstract String getArea();
    public abstract void setArea(String area);
    
    public abstract String getAssunto();
    public abstract void setAssunto(String assunto);
    
    public abstract String getRelacaoDix();
    public abstract void setRelacaoDix(String relacaoDix);
    
    public abstract void setTextoCampoLogin(String textoCampoLogin);
    public abstract void setMessage(String message);
    
    
    public void enviaEmail(IRequestCycle cycle) {
        
        //TODO: finish this method
    }
    
}



Thanks,
-- 
João Paulo Vasconcellos
MSN: vasconcellos@gmail.com

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


Re: Rewind of Form problem

Posted by João Paulo Vasconcellos <va...@gmail.com>.
It is not ideal, but I got to understand why the stale link happened
before I read the replies. Anyway, FormConditional solved my problem.

Thanks everybody.


On Thu, 24 Feb 2005 09:07:49 -0500, Bryan Lewis <br...@maine.rr.com> wrote:
> Yes, I agree with you that the situation isn't ideal.  I wasn't suggesting
> that it was _inherently_ inherent :-).  I almost added "at the current time"
> to the sentence.  I was trying to say that this is something that a newcomer
> to Tapestry does have to understand and design for.  It wasn't an isolated
> quirk of this one page.
> 
> 
> ----- Original Message -----
> From: "Hanson Char" <ha...@gmail.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Cc: "João Paulo Vasconcellos" <va...@gmail.com>
> Sent: Thursday, February 24, 2005 8:00 AM
> Subject: Re: Rewind of Form problem
> 
> > >... this situation is inherent in the way Tapestry works ...
> >
> > Sometimes this seems just not good enough.  There is a need to allow
> > the page class to handle the StaleLinkException in a more flexible
> > way.  Unfortunately, when such exception is thrown from the
> > Form.renderComponent method, the page object is not even on the call
> > stack (and therefore it can never catch it) !
> >
> > One attempted general solution to this issue is to simply have a
> > drop-in replacement of  the Tapestry Form component with something I
> > call a "LenientForm" component.  A LenientForm is exactly the same as
> > a Form except in the renderComponent method.  Instead of throwing up
> > the StaleLinkException, it saves it as a
> > "FormRewindStaleLinkException", a simple subclass of
> > StaleLinkException, in the request attributes and moves on as if the
> > exception never arised.
> >
> > Now when the thread comes to execute the page object's listener
> > method, the listener can then check from the request attributes
> > whether there exists a StaleLinkException during the form rewind, and
> > if so deal with it in whatever way it makes sense (including either
> > throwing it up or ignoring it).  At the very least the page can now
> > have the option of displaying a customized stale page to the user,
> > instead of giving them a stack trace.
> >
> > For the original problem in FaleConosco.html, it can choose to simply
> > ignore the exception.
> >
> > H
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


-- 
João Paulo Vasconcellos
MSN: vasconcellos@gmail.com

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


Re: Rewind of Form problem

Posted by Bryan Lewis <br...@maine.rr.com>.
Yes, I agree with you that the situation isn't ideal.  I wasn't suggesting
that it was _inherently_ inherent :-).  I almost added "at the current time"
to the sentence.  I was trying to say that this is something that a newcomer
to Tapestry does have to understand and design for.  It wasn't an isolated
quirk of this one page.


----- Original Message ----- 
From: "Hanson Char" <ha...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Cc: "João Paulo Vasconcellos" <va...@gmail.com>
Sent: Thursday, February 24, 2005 8:00 AM
Subject: Re: Rewind of Form problem


> >... this situation is inherent in the way Tapestry works ...
>
> Sometimes this seems just not good enough.  There is a need to allow
> the page class to handle the StaleLinkException in a more flexible
> way.  Unfortunately, when such exception is thrown from the
> Form.renderComponent method, the page object is not even on the call
> stack (and therefore it can never catch it) !
>
> One attempted general solution to this issue is to simply have a
> drop-in replacement of  the Tapestry Form component with something I
> call a "LenientForm" component.  A LenientForm is exactly the same as
> a Form except in the renderComponent method.  Instead of throwing up
> the StaleLinkException, it saves it as a
> "FormRewindStaleLinkException", a simple subclass of
> StaleLinkException, in the request attributes and moves on as if the
> exception never arised.
>
> Now when the thread comes to execute the page object's listener
> method, the listener can then check from the request attributes
> whether there exists a StaleLinkException during the form rewind, and
> if so deal with it in whatever way it makes sense (including either
> throwing it up or ignoring it).  At the very least the page can now
> have the option of displaying a customized stale page to the user,
> instead of giving them a stack trace.
>
> For the original problem in FaleConosco.html, it can choose to simply
> ignore the exception.
>
> H
>
> ---------------------------------------------------------------------
> 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: Rewind of Form problem

Posted by Hanson Char <ha...@gmail.com>.
>... this situation is inherent in the way Tapestry works ...

Sometimes this seems just not good enough.  There is a need to allow
the page class to handle the StaleLinkException in a more flexible
way.  Unfortunately, when such exception is thrown from the
Form.renderComponent method, the page object is not even on the call
stack (and therefore it can never catch it) !

One attempted general solution to this issue is to simply have a
drop-in replacement of  the Tapestry Form component with something I
call a "LenientForm" component.  A LenientForm is exactly the same as
a Form except in the renderComponent method.  Instead of throwing up
the StaleLinkException, it saves it as a
"FormRewindStaleLinkException", a simple subclass of
StaleLinkException, in the request attributes and moves on as if the
exception never arised.

Now when the thread comes to execute the page object's listener
method, the listener can then check from the request attributes
whether there exists a StaleLinkException during the form rewind, and
if so deal with it in whatever way it makes sense (including either
throwing it up or ignoring it).  At the very least the page can now
have the option of displaying a customized stale page to the user,
instead of giving them a stack trace.

For the original problem in FaleConosco.html, it can choose to simply
ignore the exception.

H

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


Re: Rewind of Form problem

Posted by Bryan Lewis <br...@maine.rr.com>.
Doing a google search for "stale link tapestry" turns up a large number of
hits.
Searching the book "Tapestry in Action" turns up 7 hits for "stale link" and
another 7 for "StaleLink".

In your example, the exception is saying that an additional component
(cArea) was found during the rewind phase when the form was submitted, that
hadn't been there when the page was first rendered.  Therefore the
Conditional around it has changed state; making that condition a persistent
property might be one solution. Using a contrib:FormConditional (or the If
component from the T-Deli) in place of the Conditional would be another.
Those are off the top of my head... this situation is inherent in the way
Tapestry works and has been discussed a lot.


----- Original Message ----- 
From: "João Paulo Vasconcellos" <va...@gmail.com>
To: "Tapestry User" <ta...@jakarta.apache.org>
Sent: Wednesday, February 23, 2005 2:59 PM
Subject: Rewind of Form problem


Hello list,

  I think I have a newbie problem, but as I cannot find anything like
this on Google...

  I have a form with three PropertySelection components, one of then
with submitOnChange=true.

  When I submit with the OnChange, the page complains like this:

You have clicked on a stale link.

Rewind of form FaleConosco/$Form expected only 1 form elements, but an
additional id was requested by component FaleConosco/cArea.

This is most likely the result of using your browser's back button,
but can also be an application error.

You may continue by returning to the application's home page.

Now I'm stuck with this. I have no idea of what is happening and
cannot find info on the web.
Hope someone can shed a light on this.

Code involved:

FaleConosco.html

<html jwcid="@Shell" title="Fale Conosco">
    <body>
        <span jwcid="@Conditional" condition="ognl:message">
            <font color="red">
                <span jwcid="@Insert" value="ognl:message">
                    Mensagem de Erro
                </span>
            </font>
        </span>
        <p/>
        <form jwcid="@Form" listener="ognl:listeners.enviaEmail">
            Rela&ccedil;&atilde;o com a Dix:
            <span jwcid="cRelacaoDix"/>
            <br>
            <span jwcid="@Conditional" condition="ognl:relacaoDix">
                <span jwcid="@Insert" value="ognl:textoCampoLogin" /> <br />
                Relação com a Dix: <span jwcid="@Insert"
value="ognl:relacaoDix" /> <br />
                &Aacute;rea respons&aacute;vel: <span jwcid="cArea"/> <br />
                Assunto: <span jwcid="cAssunto"/> <br />

            </span>

        </form>
    </body>
</html>


FaleConosco.page

<?xml version="1.0"?>

<!DOCTYPE page-specification PUBLIC
    "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

<page-specification class="web.FaleConosco">
    <property-specification name="message" type="java.lang.String"/>
    <property-specification name="relacaoDix" type="java.lang.String"/>
    <property-specification name="matricula" type="java.lang.String"/>
    <property-specification name="assunto" type="java.lang.String"/>
    <property-specification name="area" type="java.lang.String"/>
    <property-specification name="mensagem" type="java.lang.String"/>
    <property-specification name="textoCampoLogin" type="java.lang.String"/>

    <component id="cRelacaoDix" type="PropertySelection">
        <binding name="model" expression="@web.FaleConosco@cbRelacaoDix"/>
        <binding name="value" expression="relacaoDix"/>
        <binding name="submitOnChange" expression="true"/>
    </component>

    <component id="cArea" type="PropertySelection">
        <binding name="model" expression="@web.FaleConosco@cbArea"/>
        <binding name="value" expression="area"/>
        <binding name="submitOnChange" expression="false"/>
    </component>

    <component id="cAssunto" type="PropertySelection">
        <binding name="model" expression="@web.FaleConosco@cbAssunto"/>
        <binding name="value" expression="assunto"/>
        <binding name="submitOnChange" expression="false"/>
    </component>


</page-specification>


FaleConosco.java

package web;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.form.StringPropertySelectionModel;

//import org.apache.tapestry.event.PageRenderListener;

public abstract class FaleConosco extends BasePage {

    public static final IPropertySelectionModel cbRelacaoDix =
            new StringPropertySelectionModel( new String[] {
                "Selecione", "Cliente", "Credenciado", "Corretor",
"Visitante" } );

    public static final IPropertySelectionModel cbAssunto =
            new StringPropertySelectionModel( new String[] {
                "Selecione", "Sugestão", "Reclamação", "Elogio" } );

    public static final IPropertySelectionModel cbArea =
            new StringPropertySelectionModel( new String[] {
                "Selecione", "DixAmico", "Área Médica", "Comercial",
"Marketing",
                "Financeiro", "Dúvidas com a senha" } );

    public abstract String getMatricula();
    public abstract void setMatricula(String matricula);

    public abstract String getMensagem();
    public abstract void setMensagem(String mensagem);

    public abstract String getArea();
    public abstract void setArea(String area);

    public abstract String getAssunto();
    public abstract void setAssunto(String assunto);

    public abstract String getRelacaoDix();
    public abstract void setRelacaoDix(String relacaoDix);

    public abstract void setTextoCampoLogin(String textoCampoLogin);
    public abstract void setMessage(String message);


    public void enviaEmail(IRequestCycle cycle) {

        //TODO: finish this method
    }

}



Thanks,
-- 
João Paulo Vasconcellos
MSN: vasconcellos@gmail.com

---------------------------------------------------------------------
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: Rewind of Form problem

Posted by Shing Hing Man <ma...@yahoo.com>.
Inside the form, try using FormConditional component
from the contributed library, instead of Conditional 
(please see 
http://jakarta.apache.org/tapestry/doc/ComponentReference/index.html)

<span jwcid="@Conditional"    <-- try FormConditional 
    condition="ognl:relacaoDix">


You have stale link because when the page is first
rendered, the conditional inside the form is
false/null.
After you have selected from the drop down list,
the conditional inside the form is true/not null.
So in rewinding, Tapestry is expecting the components
inside the conditional tag. 

Shing






 



 --- João Paulo Vasconcellos <va...@gmail.com>
wrote: 
> Hello list,
> 
>   I think I have a newbie problem, but as I cannot
> find anything like
> this on Google...
> 
>   I have a form with three PropertySelection
> components, one of then
> with submitOnChange=true.
> 
>   When I submit with the OnChange, the page
> complains like this:
> 
> You have clicked on a stale link.
> 
> Rewind of form FaleConosco/$Form expected only 1
> form elements, but an
> additional id was requested by component
> FaleConosco/cArea.
> 
> This is most likely the result of using your
> browser's back button,
> but can also be an application error.
> 
> You may continue by returning to the application's
> home page.
> 
> Now I'm stuck with this. I have no idea of what is
> happening and
> cannot find info on the web.
> Hope someone can shed a light on this.
> 
> Code involved:
> 
> FaleConosco.html
> 
> <html jwcid="@Shell" title="Fale Conosco">
>     <body>
>         <span jwcid="@Conditional"
> condition="ognl:message">
>             <font color="red">
>                 <span jwcid="@Insert"
> value="ognl:message">
>                     Mensagem de Erro
>                 </span>
>             </font>
>         </span>
>         <p/>
>         <form jwcid="@Form"
> listener="ognl:listeners.enviaEmail">
>             Rela&ccedil;&atilde;o com a Dix:
>             <span jwcid="cRelacaoDix"/>
>             <br>
>             <span jwcid="@Conditional"
> condition="ognl:relacaoDix">
>                 <span jwcid="@Insert"
> value="ognl:textoCampoLogin" /> <br />
>                 Relação com a Dix: <span
> jwcid="@Insert"
> value="ognl:relacaoDix" /> <br />
>                 &Aacute;rea respons&aacute;vel:
> <span jwcid="cArea"/> <br />
>                 Assunto: <span jwcid="cAssunto"/>
> <br />
>                 
>             </span>
> 
>         </form>
>     </body>
> </html>
> 
> 
> FaleConosco.page
> 
> <?xml version="1.0"?>
> 
> <!DOCTYPE page-specification PUBLIC
>     "-//Apache Software Foundation//Tapestry
> Specification 3.0//EN"
>    
>
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
> 
> <page-specification class="web.FaleConosco">
>     <property-specification name="message"
> type="java.lang.String"/>
>     <property-specification name="relacaoDix"
> type="java.lang.String"/>
>     <property-specification name="matricula"
> type="java.lang.String"/>
>     <property-specification name="assunto"
> type="java.lang.String"/>
>     <property-specification name="area"
> type="java.lang.String"/>
>     <property-specification name="mensagem"
> type="java.lang.String"/>
>     <property-specification name="textoCampoLogin"
> type="java.lang.String"/>
>     
>     <component id="cRelacaoDix"
> type="PropertySelection">
>         <binding name="model"
> expression="@web.FaleConosco@cbRelacaoDix"/>
>         <binding name="value"
> expression="relacaoDix"/>
>         <binding name="submitOnChange"
> expression="true"/>
>     </component>
> 
>     <component id="cArea" type="PropertySelection">
>         <binding name="model"
> expression="@web.FaleConosco@cbArea"/>
>         <binding name="value" expression="area"/>
>         <binding name="submitOnChange"
> expression="false"/>
>     </component>
> 
>     <component id="cAssunto"
> type="PropertySelection">
>         <binding name="model"
> expression="@web.FaleConosco@cbAssunto"/>
>         <binding name="value" expression="assunto"/>
>         <binding name="submitOnChange"
> expression="false"/>
>     </component>
> 
>     
> </page-specification>
> 
> 
> FaleConosco.java
> 
> package web;
> 
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.html.BasePage;
> import
> org.apache.tapestry.form.IPropertySelectionModel;
> import
>
org.apache.tapestry.form.StringPropertySelectionModel;
> 
> //import
> org.apache.tapestry.event.PageRenderListener;
> 
> public abstract class FaleConosco extends BasePage {
>     
>     public static final IPropertySelectionModel
> cbRelacaoDix =
>             new StringPropertySelectionModel( new
> String[] {
>                 "Selecione", "Cliente",
> "Credenciado", "Corretor",
> "Visitante" } );
>     
>     public static final IPropertySelectionModel
> cbAssunto =
>             new StringPropertySelectionModel( new
> String[] {
>                 "Selecione", "Sugestão",
> "Reclamação", "Elogio" } );
>     
>     public static final IPropertySelectionModel
> cbArea =
>             new StringPropertySelectionModel( new
> String[] {
>                 "Selecione", "DixAmico", "Área
> Médica", "Comercial",
> "Marketing",
>                 "Financeiro", "Dúvidas com a senha"
> } );
>     
>     public abstract String getMatricula();
>     public abstract void setMatricula(String
> matricula);
>     
>     public abstract String getMensagem();
>     public abstract void setMensagem(String
> mensagem);
>     
>     public abstract String getArea();
>     public abstract void setArea(String area);
>     
>     public abstract String getAssunto();
>     public abstract void setAssunto(String assunto);
>     
>     public abstract String getRelacaoDix();
>     public abstract void setRelacaoDix(String
> relacaoDix);
>     
>     public abstract void setTextoCampoLogin(String
> textoCampoLogin);
>     public abstract void setMessage(String message);
>     
>     
>     public void enviaEmail(IRequestCycle cycle) {
>         
>         //TODO: finish this method
>     }
>     
> }
> 
> 
> 
=== message truncated === 

=====
Home page :
  http://uk.geocities.com/matmsh/index.html


	
	
		
___________________________________________________________ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

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