You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Grigoris Ioannou <ho...@gmail.com> on 2008/01/25 15:29:46 UTC

T4.1.3 Page rewind

Good evening all,

I have a question regarding Tapestry 4.1.3 and page rewinding. So, in my
page, there is a @For component:

  <component id="roomFacilities" type="For">
    <binding name="source" value=" room.facilities" />
    <binding name="value" value="currentRoomFacility" />
    <binding name="index" value="currentRoomFacilityIndex" />
    <binding name="converter" value="facilityConverter" />
  </component>

I implemented the IPrimaryKeyConverter interface and at first pass it works
fine. But when the form is submitted, i see that the page tries to render
itself again, finding the room parameter null, and ofcourse throwing a null
exception, without even entering the facilityConverter.

I also note that the problem remains even if I include this @For component
inside an @If component (in the .html page):

<div jwcid="@If" condition="ognl:room.facilities.size() > 0">
  <span jwcid="roomFacilities">
</div>

Is there a way to avoid this stupid null exception? Can I somehow disable
page re-rendering on rewind? I would like to avoid persisting anything in
the session.

Thank you in advance,
Grigoris

Re: T4.1.3 Page rewind

Posted by Grigoris Ioannou <ho...@gmail.com>.
It worked after all.
The trick was to create a page property with the facilities list and
initialize it during pageBeginRender. It seems that ognl has a problem with
expressions of the type a.b.c where b or c is null.

So the solution was to add in .page:
  <property name="roomFacilityList"/>

  <component id="roomFacilityLoop" type="For">
    <binding name="source" value="roomFacilityList"/>
    <binding name="value" value="currentRoomFacility" />
    <binding name="index" value="currentRoomFacilityIndex" />
    <binding name="converter" value="facilityConverter" />
  </component>

and in pageBeginRender:

setRoomFacilityList(getRoom().getFacilities());
...along with an IPrimaryKeyConverter implementation in the same .java file
(without this, the data that gets transmitted during form rewind can get
huge).

Grigoris

On Jan 25, 2008 7:51 PM, Ulrich Stärk <ul...@spielviel.de> wrote:

> Page rewinding is a necessary mechanism to map HTML attribute names and
> their values to the corresponding page properties. When the page is
> rendered, Tapestry generates HTML attribute names and values for each
> element inside your form. When the form is submitted the same mechanism
> makes sure the submitted values map correctly to your page properties.
> There is no way to get around this. So you will either have to persist
> your room facility in the session or if it is a persistent object you
> could just store its identifier and load it from your persistence store
> upon rewinding. You'ld do this by implementing one of the interfaces
> mentioned here:
> http://tapestry.apache.org/tapestry4.1/usersguide/events.html
>
> Uli
>
> Grigoris Ioannou schrieb:
> > Good evening all,
> >
> > I have a question regarding Tapestry 4.1.3 and page rewinding. So, in my
> > page, there is a @For component:
> >
> >   <component id="roomFacilities" type="For">
> >     <binding name="source" value=" room.facilities" />
> >     <binding name="value" value="currentRoomFacility" />
> >     <binding name="index" value="currentRoomFacilityIndex" />
> >     <binding name="converter" value="facilityConverter" />
> >   </component>
> >
> > I implemented the IPrimaryKeyConverter interface and at first pass it
> works
> > fine. But when the form is submitted, i see that the page tries to
> render
> > itself again, finding the room parameter null, and ofcourse throwing a
> null
> > exception, without even entering the facilityConverter.
> >
> > I also note that the problem remains even if I include this @For
> component
> > inside an @If component (in the .html page):
> >
> > <div jwcid="@If" condition="ognl:room.facilities.size() > 0">
> >   <span jwcid="roomFacilities">
> > </div>
> >
> > Is there a way to avoid this stupid null exception? Can I somehow
> disable
> > page re-rendering on rewind? I would like to avoid persisting anything
> in
> > the session.
> >
> > Thank you in advance,
> > Grigoris
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: BeanEditForm questions

Posted by Howard Lewis Ship <hl...@gmail.com>.
Please see examples:
http://tapestry.formos.com/nightly/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/TextField.html

On Feb 8, 2008 9:19 AM, Zheng, Xiahong <Xi...@fmr.com> wrote:
> I am getting the following exception when I moved the CreateAddress page
> from tutorial1 to my T5 project as is.
>
> Org.apache.tapestry.ioc.internal.util.TapestryException
>
> Failure reading parameters validate of component
> core/PropertyEditBlocks:textfield: Validator 'regexp' requires a
> validation constraint (of type java.util.regex.Pattern) but none was
> provided.
>
>
> What am I missing here? How do I provide the validatin constraint?
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


T5: BeanEditForm questions

Posted by "Zheng, Xiahong" <Xi...@FMR.COM>.
I am getting the following exception when I moved the CreateAddress page
from tutorial1 to my T5 project as is.

Org.apache.tapestry.ioc.internal.util.TapestryException

Failure reading parameters validate of component
core/PropertyEditBlocks:textfield: Validator 'regexp' requires a
validation constraint (of type java.util.regex.Pattern) but none was
provided.


What am I missing here? How do I provide the validatin constraint?

Thanks

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


Re: T4.1.3 Page rewind

Posted by Ulrich Stärk <ul...@spielviel.de>.
Page rewinding is a necessary mechanism to map HTML attribute names and 
their values to the corresponding page properties. When the page is 
rendered, Tapestry generates HTML attribute names and values for each 
element inside your form. When the form is submitted the same mechanism 
makes sure the submitted values map correctly to your page properties. 
There is no way to get around this. So you will either have to persist 
your room facility in the session or if it is a persistent object you 
could just store its identifier and load it from your persistence store 
upon rewinding. You'ld do this by implementing one of the interfaces 
mentioned here: 
http://tapestry.apache.org/tapestry4.1/usersguide/events.html

Uli

Grigoris Ioannou schrieb:
> Good evening all,
> 
> I have a question regarding Tapestry 4.1.3 and page rewinding. So, in my
> page, there is a @For component:
> 
>   <component id="roomFacilities" type="For">
>     <binding name="source" value=" room.facilities" />
>     <binding name="value" value="currentRoomFacility" />
>     <binding name="index" value="currentRoomFacilityIndex" />
>     <binding name="converter" value="facilityConverter" />
>   </component>
> 
> I implemented the IPrimaryKeyConverter interface and at first pass it works
> fine. But when the form is submitted, i see that the page tries to render
> itself again, finding the room parameter null, and ofcourse throwing a null
> exception, without even entering the facilityConverter.
> 
> I also note that the problem remains even if I include this @For component
> inside an @If component (in the .html page):
> 
> <div jwcid="@If" condition="ognl:room.facilities.size() > 0">
>   <span jwcid="roomFacilities">
> </div>
> 
> Is there a way to avoid this stupid null exception? Can I somehow disable
> page re-rendering on rewind? I would like to avoid persisting anything in
> the session.
> 
> Thank you in advance,
> Grigoris
> 


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