You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mite <mi...@gmail.com> on 2009/10/23 23:05:25 UTC
Tapestry seems to delete object data
Hello to everyone on the forum.
I have these two pages:
-------------------------------------------------------------------------
import org.apache.tapestry5.annotations.InjectPage;
public class Index
{
private String message;
@InjectPage
private Second second;
public String getMessage() {
return message;
}
public void setMessage(String textField) {
this.message = textField;
}
Object onSubmitFromUserInputForm(){
second.setParam(message);
return second;
}
}
<html t:type="layout" title="school Index"
t:sidebarTitle="Current Time"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">
<p:sidebar>
<t:form t:id="userInputForm">
<t:textfield t:value="message"/>
<input type="submit" value="Submit"/>
</t:form>
</p:sidebar>
</html>
----------------------------------------------------------------------------------------------
public class Second
{
private String param;
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
}
<html t:type="layout" title="Second page"
t:sidebarTitle="Current Time"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">
<p:sidebar>
<p>1</p>
<p>${param}</p>
<p>3</p>
</p:sidebar>
</html>
The problem that occurs is the following. Every time I submit the form from
the Index page and get redirected to the Second page, the data from the form
is not transfered. I get blank space instead of the data. It seems like
Tapestry creates a new object after it redirects me to Second.
Can somebody point me to where is the problem?
Thank you in advance
--
View this message in context: http://www.nabble.com/Tapestry-seems-to-delete-object-data-tp26033218p26033218.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: Tapestry seems to delete object data
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 23 Oct 2009 19:10:59 -0200, Toby Hobson
<to...@googlemail.com> escreveu:
> Sorry Thiago .. you just beat me ;-)
No need to apologize. Your explanation complements mine and was just a
couple minutes late. :)
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry seems to delete object data
Posted by Toby Hobson <to...@googlemail.com>.
Sorry Thiago .. you just beat me ;-)
2009/10/23 Thiago H. de Paula Figueiredo <th...@gmail.com>
> Em Fri, 23 Oct 2009 19:05:25 -0200, Mite <mi...@gmail.com> escreveu:
>
> import org.apache.tapestry5.annotations.InjectPage;
>>
>> public class Index
>> {
>> private String message;
>>
>
> Tapestry uses redirect-after-post, so the action request is not the same as
> the request that generates HTML. You'll need to persist the field value in
> some way.
> You can do that adding the @Persist(PersistenceConstants.FLASH) annotation
> to the message field:
>
> @Persist(PersistenceConstants.FLASH)
> private String message;
>
> More details here:
> http://tapestry.apache.org/tapestry5.1/guide/persist.html
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: Tapestry seems to delete object data
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 23 Oct 2009 19:25:45 -0200, Mite <mi...@gmail.com> escreveu:
> I made some efforts to solve it on my own at first, but that was not
> possible. It wouldn't have been fair to you guys if I immediately posted
> the question.
You're right. Try yourself at first, then read documentation and search
Google, forums and mailing list archives, ask in the mailing list if the
question persists. Anyway, that 'please do my homework' questions are
quite rare in this mailing list.
> Read you on the forums.
This is technically a mailing list, but some other sites, like Nabble,
also provide a forum front-end for it. </pedantic> :P
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry seems to delete object data
Posted by cordenier christophe <ch...@gmail.com>.
Hi
Can i add a point on activation/passivation to persist data between request
? Because i like so much this feature for stateless pages :)
http://tapestry.apache.org/tapestry5.1/guide/pagenav.html
Cheers
Christophe
2009/10/23 Mite <mi...@gmail.com>
>
> I made some efforts to solve it on my own at first, but that was not
> possible. It wouldn't have been fair to you guys if I immediately posted
> the
> question.
>
> Read you on the forums.
> Mite
> --
> View this message in context:
> http://www.nabble.com/Tapestry-seems-to-delete-object-data-tp26033218p26033466.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: Tapestry seems to delete object data
Posted by Mite <mi...@gmail.com>.
I made some efforts to solve it on my own at first, but that was not
possible. It wouldn't have been fair to you guys if I immediately posted the
question.
Read you on the forums.
Mite
--
View this message in context: http://www.nabble.com/Tapestry-seems-to-delete-object-data-tp26033218p26033466.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: Tapestry seems to delete object data
Posted by Toby Hobson <to...@googlemail.com>.
Sorry you spent an hour on that. In future please don't suffer in silence
... if you hit problems let us know and we'll try to help ... the guys on
the mailing list don't bite ;-)
2009/10/23 Mite <mi...@gmail.com>
>
> Thank you guys. The problem is solved.
> I am beginner in this, and really like the concept of Tapestry. This
> problem
> gave me an hour of troubles, but now my love for the framework is back to
> 100%. :)
>
> Thanks again.
> Mite
>
> --
> View this message in context:
> http://www.nabble.com/Tapestry-seems-to-delete-object-data-tp26033218p26033406.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: Tapestry seems to delete object data
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 23 Oct 2009 19:19:44 -0200, Mite <mi...@gmail.com> escreveu:
> Thank you guys. The problem is solved.
You're welcome!
> I am beginner in this, and really like the concept of Tapestry. This
> problem gave me an hour of troubles, but now my love for the framework
> is back to
> 100%. :)
It'll reach 120% when you start using Grid, BeanEditoForm/BeanEditor,
Zone, etc. :D
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry seems to delete object data
Posted by Mite <mi...@gmail.com>.
Thank you guys. The problem is solved.
I am beginner in this, and really like the concept of Tapestry. This problem
gave me an hour of troubles, but now my love for the framework is back to
100%. :)
Thanks again.
Mite
--
View this message in context: http://www.nabble.com/Tapestry-seems-to-delete-object-data-tp26033218p26033406.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: Tapestry seems to delete object data
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 23 Oct 2009 19:05:25 -0200, Mite <mi...@gmail.com> escreveu:
> import org.apache.tapestry5.annotations.InjectPage;
>
> public class Index
> {
> private String message;
Tapestry uses redirect-after-post, so the action request is not the same
as the request that generates HTML. You'll need to persist the field value
in some way.
You can do that adding the @Persist(PersistenceConstants.FLASH) annotation
to the message field:
@Persist(PersistenceConstants.FLASH)
private String message;
More details here:
http://tapestry.apache.org/tapestry5.1/guide/persist.html
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry seems to delete object data
Posted by Toby Hobson <to...@googlemail.com>.
Hi Mike
You need to make the param persistent. By default properties are not
persisted between requests and what's actually happening here is a redirect
after post, i.e. two requests
This should get you on the right track:
public class Second
{
@Persist("session") // or use @Persist("flash") or @Persist("client")
private String param;
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
}
2009/10/23 Mite <mi...@gmail.com>
>
> Hello to everyone on the forum.
>
> I have these two pages:
>
> -------------------------------------------------------------------------
>
> import org.apache.tapestry5.annotations.InjectPage;
>
> public class Index
> {
> private String message;
>
> @InjectPage
> private Second second;
>
> public String getMessage() {
> return message;
> }
>
> public void setMessage(String textField) {
> this.message = textField;
> }
>
> Object onSubmitFromUserInputForm(){
> second.setParam(message);
> return second;
> }
>
> }
>
> <html t:type="layout" title="school Index"
> t:sidebarTitle="Current Time"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> xmlns:p="tapestry:parameter">
> <p:sidebar>
> <t:form t:id="userInputForm">
> <t:textfield t:value="message"/>
> <input type="submit" value="Submit"/>
> </t:form>
>
> </p:sidebar>
> </html>
>
>
> ----------------------------------------------------------------------------------------------
>
> public class Second
> {
> private String param;
>
> public String getParam() {
> return param;
> }
>
> public void setParam(String param) {
> this.param = param;
> }
> }
>
>
> <html t:type="layout" title="Second page"
> t:sidebarTitle="Current Time"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> xmlns:p="tapestry:parameter">
>
> <p:sidebar>
> <p>1</p>
> <p>${param}</p>
> <p>3</p>
> </p:sidebar>
>
> </html>
>
>
> The problem that occurs is the following. Every time I submit the form
> from
> the Index page and get redirected to the Second page, the data from the
> form
> is not transfered. I get blank space instead of the data. It seems like
> Tapestry creates a new object after it redirects me to Second.
>
> Can somebody point me to where is the problem?
>
> Thank you in advance
>
> --
> View this message in context:
> http://www.nabble.com/Tapestry-seems-to-delete-object-data-tp26033218p26033218.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
>
>