You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Maik Dobryn <ma...@dobryn.de> on 2005/02/04 03:28:37 UTC

Tapestry Bucket Brigade - Why does it not work for me?

Hi all,

I'm new to Tapestry and I simply want to use a form more than once per 
session.

The workflow scenario looks like:

1. On the first form entrance the only input field holds the presetted name 
"Max Data". (as expected)
2. I do change the name to "John Wayne" and submit the form. (My doSomething() 
method displays "John Wayne" on System.out - as expected)
3. The form page is displayed  again with "John Wayne" in the input field. 
(also as expected)
4. After changing the name to "Foo Bar" I do submit the form again. (Now I 
would expect "Foo Bar" on System.out but "John Wayne" appears instead)


What am I doing wrong?

Best regards

Maik
 

[ Home.html ]
...
<form jwcid="myForm">
   <label>Please enter your Name: </label>
   <input jwcid="fromName" type="text" size="30"/><br/>

   <input type="submit" value="Submit"/>
</form>
...


[ Home.page ]
...
<page-specification class="myPackage.Home">
   <component id="myForm" type="Form">
      <binding name="listener" expression="listeners.submitAction"/>
   </component>

   <component id="fromName" type="TextField">
      <binding name="value" expression="fromName"/>
   </component>

   <property-specification name="fromName" type="java.lang.String"
      persistent="yes">"Max Data"</property-specification>
</page-specification>


[ Home.java ]
...
public abstract class Home extends BasePage {

   public abstract void setFromName( String s );
   public abstract String getFromName();

   public void submitAction( IRequestCycle cycle ) {
      Home nextPage = (Home) cycle.getPage( "Home" );

      doSomething( getFromName() );
      nextPage.setFromName( getFromName()  );

      cycle.activate( nextPage );
   }
   ...
}

-- 

  Maik  D o b r y n
____________________________________________

  Email : maik@dobryn.de
____________________________________________


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


Re: Tapestry Bucket Brigade - Why does it not work for me?

Posted by Paul Ferraro <pm...@columbia.edu>.
Your fromName property should not be persistent.  Let the Form take care 
of persisting (i.e. posting) its value from page1 -> page2.
Also, you don't need to call cycle.activate() if you are not changing 
pages between rewind and render cycles.

Paul

Maik Dobryn wrote:

>Hi all,
>
>I'm new to Tapestry and I simply want to use a form more than once per 
>session.
>
>The workflow scenario looks like:
>
>1. On the first form entrance the only input field holds the presetted name 
>"Max Data". (as expected)
>2. I do change the name to "John Wayne" and submit the form. (My doSomething() 
>method displays "John Wayne" on System.out - as expected)
>3. The form page is displayed  again with "John Wayne" in the input field. 
>(also as expected)
>4. After changing the name to "Foo Bar" I do submit the form again. (Now I 
>would expect "Foo Bar" on System.out but "John Wayne" appears instead)
>
>
>What am I doing wrong?
>
>Best regards
>
>Maik
> 
>
>[ Home.html ]
>...
><form jwcid="myForm">
>   <label>Please enter your Name: </label>
>   <input jwcid="fromName" type="text" size="30"/><br/>
>
>   <input type="submit" value="Submit"/>
></form>
>...
>
>
>[ Home.page ]
>...
><page-specification class="myPackage.Home">
>   <component id="myForm" type="Form">
>      <binding name="listener" expression="listeners.submitAction"/>
>   </component>
>
>   <component id="fromName" type="TextField">
>      <binding name="value" expression="fromName"/>
>   </component>
>
>   <property-specification name="fromName" type="java.lang.String"
>      persistent="yes">"Max Data"</property-specification>
></page-specification>
>
>
>[ Home.java ]
>...
>public abstract class Home extends BasePage {
>
>   public abstract void setFromName( String s );
>   public abstract String getFromName();
>
>   public void submitAction( IRequestCycle cycle ) {
>      Home nextPage = (Home) cycle.getPage( "Home" );
>
>      doSomething( getFromName() );
>      nextPage.setFromName( getFromName()  );
>
>      cycle.activate( nextPage );
>   }
>   ...
>}
>
>  
>


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


Re: Tapestry Bucket Brigade - Why does it not work for me?

Posted by Maik Dobryn <ma...@dobryn.de>.
Howard,

thanks for your quick response.

> Because you are saying getPage("Home"), not
> getPage("WhateverTheNextPageIsCalled").

I am building my first Tapestry application step by step. On this early stage 
it only consists of one page - Home. So, my next page is Home.

If I use the hole specification, e.g. getPage("myPackage.Home") I get a - Page 
'myPackage.Home' not found in application namespace. - 
org.apache.tapestry.ApplicationRuntimeException


Regards

Maik

-- 

  Maik  D o b r y n
____________________________________________

  Email : maik@dobryn.de
____________________________________________


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


Re: Tapestry Bucket Brigade - Why does it not work for me?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Because you are saying getPage("Home"), not
getPage("WhateverTheNextPageIsCalled").


On Fri, 4 Feb 2005 03:28:37 +0100, Maik Dobryn <ma...@dobryn.de> wrote:
> 
> Hi all,
> 
> I'm new to Tapestry and I simply want to use a form more than once per
> session.
> 
> The workflow scenario looks like:
> 
> 1. On the first form entrance the only input field holds the presetted name
> "Max Data". (as expected)
> 2. I do change the name to "John Wayne" and submit the form. (My doSomething()
> method displays "John Wayne" on System.out - as expected)
> 3. The form page is displayed  again with "John Wayne" in the input field.
> (also as expected)
> 4. After changing the name to "Foo Bar" I do submit the form again. (Now I
> would expect "Foo Bar" on System.out but "John Wayne" appears instead)
> 
> What am I doing wrong?
> 
> Best regards
> 
> Maik
> 
> [ Home.html ]
> ...
> <form jwcid="myForm">
>    <label>Please enter your Name: </label>
>    <input jwcid="fromName" type="text" size="30"/><br/>
> 
>    <input type="submit" value="Submit"/>
> </form>
> ...
> 
> [ Home.page ]
> ...
> <page-specification class="myPackage.Home">
>    <component id="myForm" type="Form">
>       <binding name="listener" expression="listeners.submitAction"/>
>    </component>
> 
>    <component id="fromName" type="TextField">
>       <binding name="value" expression="fromName"/>
>    </component>
> 
>    <property-specification name="fromName" type="java.lang.String"
>       persistent="yes">"Max Data"</property-specification>
> </page-specification>
> 
> [ Home.java ]
> ...
> public abstract class Home extends BasePage {
> 
>    public abstract void setFromName( String s );
>    public abstract String getFromName();
> 
>    public void submitAction( IRequestCycle cycle ) {
>       Home nextPage = (Home) cycle.getPage( "Home" );
> 
>       doSomething( getFromName() );
>       nextPage.setFromName( getFromName()  );
> 
>       cycle.activate( nextPage );
>    }
>    ...
> }
> 
> --
> 
>   Maik  D o b r y n
> ____________________________________________
> 
>   Email : maik@dobryn.de
> ____________________________________________
> 
> ---------------------------------------------------------------------
> 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