You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by nkonstantinou <nk...@upcom.eu> on 2007/11/16 13:38:59 UTC
T4.1.3 Form submission
Hi all,
I'm facing this problem with T4.1.3. I have a page with a Form and I
want to submit a value of the roomQuote object to the next page. The
problem is that the page is reloading itself when the form is
submitted having as a result to lose the object's (roomQuote) value.
More specifically, I want to "carry" this object with me when I submit
the form.
I use a System.out.println() on the listener that is on the submit
button of the form, and my object is null in the listener, so the
value is lost BEFORE(?) submitting the Form. What is the best
practice? I'm stuck!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T4.1.3 Form submission
Posted by Andreas Andreou <an...@gmail.com>.
Well, it's not persisted, but it's supposed to be passed on through
the hidden field
But i dont see how roomQuote is initially set...
So, it looks like it's always null - and of course remains null
BTW, replace onchange="javascript:this.form.submit();" with
onchange="tapestry.form.submit(this.form)" cause it's long deprecated
On Nov 16, 2007 3:31 PM, Alejandro Scandroli
<al...@gmail.com> wrote:
> Hi Nikolaos
>
> At first sight it looks like roomQuote is not persisted.
> Try
> @Persist
> public abstract IRoomQuote getRoomQuote();
>
> or
> <property name="roomQuote" persist="session"/>
>
> Alejandro.
>
>
> On Nov 16, 2007 2:11 PM, Nikolaos Konstantinou <nk...@cn.ntua.gr> wrote:
> > So, the java page is
> >
> > public abstract class RegistrationPage extends BasePage implements
> > IExternalPage, PageBeginRenderListener {
> > public abstract IRoomQuote getRoomQuote();
> > public abstract void setRoomQuote(IRoomQuote roomQuote);
> > ...
> > public void pageBeginRender(PageEvent event) {
> > System.out.println("RegistrationPage");
> > }
> >
> > public void onSelectCountrySubmit(IRequestCycle cycle) {
> > System.out.println("onSelectCountryubmit");
> > RegistrationDetailPage registrationDetailPage =
> > (RegistrationDetailPage) cycle.getPage("RegistrationDetail");
> > registrationDetailPage.setCity("London");
> > registrationDetailPage.setRoomQuote(getRoomQuote());
> > cycle.activate(registrationDetailPage);
> > }
> > ...
> > }
> >
> > The html page
> > ...
> > <form jwcid="selectCountryForm@Form"
> > listener="listener:onSelectCountrySubmit"
> > delegate="ognl:beans.validationDelegate"
> > success="listener:onSelectCountrySubmit"
> > updateComponents="selectCountry"
> > method="get"
> > stateful="false">
> > <input type="hidden" jwcid="@Hidden" value="ognl:roomQuote"/>
> > ...
> > Please select your country:
> > <select jwcid="selectCountry"
> > onchange="javascript:this.form.submit();">
> > <option value="1">Greece</option>
> > <option value="2">USA</option>
> > </select>
> >
> > and at the .page:
> >
> > <page-specification class="com.dilos.web.page.RegistrationPage">
> > ...
> > <property name="countryModel"/>
> > <property name="country"/>
> >
> > <component id="selectCountry" type="PropertySelection">
> > <binding name="model" value="countryModel"/>
> > <binding name="value" value="country"/>
> > </component>
> > ...
> > </page-specification>
> >
> > The problem is that the roomQuote object is null when the listener
> > onSelectCountrySubmit is invoked. I see in the console that when I
> > change the value of the drop-down list, the form is submitted (because
> > of the onChange), I see first the RegistrationPage that is in the
> > PageBeginRender and then the listener, but then the getRoomQuote is
> > null. What am I doing wrong?
> >
> >
> >
> > On Nov 16, 2007 3:00 PM, Andreas Andreou <an...@gmail.com> wrote:
> > > Well, you must be doing something wrong... is it possible to
> > > show some code?
> > >
> > >
> > > On Nov 16, 2007 2:38 PM, nkonstantinou <nk...@upcom.eu> wrote:
> > > > Hi all,
> > > >
> > > > I'm facing this problem with T4.1.3. I have a page with a Form and I
> > > > want to submit a value of the roomQuote object to the next page. The
> > > > problem is that the page is reloading itself when the form is
> > > > submitted having as a result to lose the object's (roomQuote) value.
> > > > More specifically, I want to "carry" this object with me when I submit
> > > > the form.
> > > >
> > > > I use a System.out.println() on the listener that is on the submit
> > > > button of the form, and my object is null in the listener, so the
> > > > value is lost BEFORE(?) submitting the Form. What is the best
> > > > practice? I'm stuck!
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> > > Tapestry / Tacos developer
> > > Open Source / JEE Consulting
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T4.1.3 Form submission
Posted by Alejandro Scandroli <al...@gmail.com>.
Hi Nikolaos
At first sight it looks like roomQuote is not persisted.
Try
@Persist
public abstract IRoomQuote getRoomQuote();
or
<property name="roomQuote" persist="session"/>
Alejandro.
On Nov 16, 2007 2:11 PM, Nikolaos Konstantinou <nk...@cn.ntua.gr> wrote:
> So, the java page is
>
> public abstract class RegistrationPage extends BasePage implements
> IExternalPage, PageBeginRenderListener {
> public abstract IRoomQuote getRoomQuote();
> public abstract void setRoomQuote(IRoomQuote roomQuote);
> ...
> public void pageBeginRender(PageEvent event) {
> System.out.println("RegistrationPage");
> }
>
> public void onSelectCountrySubmit(IRequestCycle cycle) {
> System.out.println("onSelectCountryubmit");
> RegistrationDetailPage registrationDetailPage =
> (RegistrationDetailPage) cycle.getPage("RegistrationDetail");
> registrationDetailPage.setCity("London");
> registrationDetailPage.setRoomQuote(getRoomQuote());
> cycle.activate(registrationDetailPage);
> }
> ...
> }
>
> The html page
> ...
> <form jwcid="selectCountryForm@Form"
> listener="listener:onSelectCountrySubmit"
> delegate="ognl:beans.validationDelegate"
> success="listener:onSelectCountrySubmit"
> updateComponents="selectCountry"
> method="get"
> stateful="false">
> <input type="hidden" jwcid="@Hidden" value="ognl:roomQuote"/>
> ...
> Please select your country:
> <select jwcid="selectCountry"
> onchange="javascript:this.form.submit();">
> <option value="1">Greece</option>
> <option value="2">USA</option>
> </select>
>
> and at the .page:
>
> <page-specification class="com.dilos.web.page.RegistrationPage">
> ...
> <property name="countryModel"/>
> <property name="country"/>
>
> <component id="selectCountry" type="PropertySelection">
> <binding name="model" value="countryModel"/>
> <binding name="value" value="country"/>
> </component>
> ...
> </page-specification>
>
> The problem is that the roomQuote object is null when the listener
> onSelectCountrySubmit is invoked. I see in the console that when I
> change the value of the drop-down list, the form is submitted (because
> of the onChange), I see first the RegistrationPage that is in the
> PageBeginRender and then the listener, but then the getRoomQuote is
> null. What am I doing wrong?
>
>
>
> On Nov 16, 2007 3:00 PM, Andreas Andreou <an...@gmail.com> wrote:
> > Well, you must be doing something wrong... is it possible to
> > show some code?
> >
> >
> > On Nov 16, 2007 2:38 PM, nkonstantinou <nk...@upcom.eu> wrote:
> > > Hi all,
> > >
> > > I'm facing this problem with T4.1.3. I have a page with a Form and I
> > > want to submit a value of the roomQuote object to the next page. The
> > > problem is that the page is reloading itself when the form is
> > > submitted having as a result to lose the object's (roomQuote) value.
> > > More specifically, I want to "carry" this object with me when I submit
> > > the form.
> > >
> > > I use a System.out.println() on the listener that is on the submit
> > > button of the form, and my object is null in the listener, so the
> > > value is lost BEFORE(?) submitting the Form. What is the best
> > > practice? I'm stuck!
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> >
> > --
> > Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> > Tapestry / Tacos developer
> > Open Source / JEE Consulting
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T4.1.3 Form submission
Posted by Nikolaos Konstantinou <nk...@cn.ntua.gr>.
So, the java page is
public abstract class RegistrationPage extends BasePage implements
IExternalPage, PageBeginRenderListener {
public abstract IRoomQuote getRoomQuote();
public abstract void setRoomQuote(IRoomQuote roomQuote);
...
public void pageBeginRender(PageEvent event) {
System.out.println("RegistrationPage");
}
public void onSelectCountrySubmit(IRequestCycle cycle) {
System.out.println("onSelectCountryubmit");
RegistrationDetailPage registrationDetailPage =
(RegistrationDetailPage) cycle.getPage("RegistrationDetail");
registrationDetailPage.setCity("London");
registrationDetailPage.setRoomQuote(getRoomQuote());
cycle.activate(registrationDetailPage);
}
...
}
The html page
...
<form jwcid="selectCountryForm@Form"
listener="listener:onSelectCountrySubmit"
delegate="ognl:beans.validationDelegate"
success="listener:onSelectCountrySubmit"
updateComponents="selectCountry"
method="get"
stateful="false">
<input type="hidden" jwcid="@Hidden" value="ognl:roomQuote"/>
...
Please select your country:
<select jwcid="selectCountry"
onchange="javascript:this.form.submit();">
<option value="1">Greece</option>
<option value="2">USA</option>
</select>
and at the .page:
<page-specification class="com.dilos.web.page.RegistrationPage">
...
<property name="countryModel"/>
<property name="country"/>
<component id="selectCountry" type="PropertySelection">
<binding name="model" value="countryModel"/>
<binding name="value" value="country"/>
</component>
...
</page-specification>
The problem is that the roomQuote object is null when the listener
onSelectCountrySubmit is invoked. I see in the console that when I
change the value of the drop-down list, the form is submitted (because
of the onChange), I see first the RegistrationPage that is in the
PageBeginRender and then the listener, but then the getRoomQuote is
null. What am I doing wrong?
On Nov 16, 2007 3:00 PM, Andreas Andreou <an...@gmail.com> wrote:
> Well, you must be doing something wrong... is it possible to
> show some code?
>
>
> On Nov 16, 2007 2:38 PM, nkonstantinou <nk...@upcom.eu> wrote:
> > Hi all,
> >
> > I'm facing this problem with T4.1.3. I have a page with a Form and I
> > want to submit a value of the roomQuote object to the next page. The
> > problem is that the page is reloading itself when the form is
> > submitted having as a result to lose the object's (roomQuote) value.
> > More specifically, I want to "carry" this object with me when I submit
> > the form.
> >
> > I use a System.out.println() on the listener that is on the submit
> > button of the form, and my object is null in the listener, so the
> > value is lost BEFORE(?) submitting the Form. What is the best
> > practice? I'm stuck!
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
>
> --
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Tapestry / Tacos developer
> Open Source / JEE Consulting
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T4.1.3 Form submission
Posted by Andreas Andreou <an...@gmail.com>.
Well, you must be doing something wrong... is it possible to
show some code?
On Nov 16, 2007 2:38 PM, nkonstantinou <nk...@upcom.eu> wrote:
> Hi all,
>
> I'm facing this problem with T4.1.3. I have a page with a Form and I
> want to submit a value of the roomQuote object to the next page. The
> problem is that the page is reloading itself when the form is
> submitted having as a result to lose the object's (roomQuote) value.
> More specifically, I want to "carry" this object with me when I submit
> the form.
>
> I use a System.out.println() on the listener that is on the submit
> button of the form, and my object is null in the listener, so the
> value is lost BEFORE(?) submitting the Form. What is the best
> practice? I'm stuck!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org