You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ruud Diterwich <rd...@cedron.com> on 2003/06/23 13:10:13 UTC

persistent properties

I've just started discovering Tapestry, and I think I'm missing some
basic concepts regarding component state. Can anyone explain me why this
example does not work?

*** MyEdit.page ***

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
  "-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
  "http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">

<page-specification class="com.cedron.dmc.gui.pages.MyEdit">
	<property-specification name="count" initial-value="0"
type="int" persistent="false"/>
</page-specification>


*** MyEdit.html ***

<html>
	value: <span jwcid="@Insert" value="ognl:count"/>
	<span jwcid="@ActionLink"
listener="ognl:listeners.incrementCount">increment</span>
</html>


*** MyEdit.java ***

package com.myproduct.gui.pages;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;

public abstract class MyEdit extends BasePage {

	public abstract int getCount();
	public abstract void setCount(int count);

	public void incrementCount(IRequestCycle cycle) {
		setCount(getCount() + 1);	
	}
}

The count is updated one, from 0 to 1, but successive clicks keep the
counter on 1!

Thanks!

Ruud Diterwich


RE: persistent properties

Posted by Ruud Diterwich <rd...@cedron.com>.
Thanks! Silly, Boolean values are "yes" and "no" apparently.

-----Original Message-----
From: Geoff Longman [mailto:glongman@intelligentworks.com] 
Sent: Monday, June 23, 2003 13:15
To: Tapestry users
Subject: Re: persistent properties

The property specification indicates that count is not persistent.

> <property-specification name="count" initial-value="0"
> type="int" persistent="false"/>
                   ^^^^^^^^^^^^

thus, the count is reset to 0 after every request (click). change
persitent
to 'yes'.

Geoff



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


Re: persistent properties

Posted by Geoff Longman <gl...@intelligentworks.com>.
The property specification indicates that count is not persistent.

> <property-specification name="count" initial-value="0"
> type="int" persistent="false"/>
                   ^^^^^^^^^^^^

thus, the count is reset to 0 after every request (click). change persitent
to 'yes'.

Geoff



RE: persistent properties

Posted by Ruud Diterwich <rd...@cedron.com>.
Sorry, there was a mistake in the example: the property specification
should have the persistent attribute set to true, of course:

<property-specification name="count" initial-value="0"
type="int" persistent="true"/>

Even with persistent set to true, the count seems to be reset to 0 on
each click!

Ruud Diterwich

-----Original Message-----
From: Ruud Diterwich [mailto:rditerwich@cedron.com] 
Sent: Monday, June 23, 2003 13:10
To: tapestry-user@jakarta.apache.org
Subject: persistent properties

I've just started discovering Tapestry, and I think I'm missing some
basic concepts regarding component state. Can anyone explain me why this
example does not work?

*** MyEdit.page ***

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
  "-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
  "http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">

<page-specification class="com.cedron.dmc.gui.pages.MyEdit">
	<property-specification name="count" initial-value="0"
type="int" persistent="false"/>
</page-specification>


*** MyEdit.html ***

<html>
	value: <span jwcid="@Insert" value="ognl:count"/>
	<span jwcid="@ActionLink"
listener="ognl:listeners.incrementCount">increment</span>
</html>


*** MyEdit.java ***

package com.myproduct.gui.pages;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;

public abstract class MyEdit extends BasePage {

	public abstract int getCount();
	public abstract void setCount(int count);

	public void incrementCount(IRequestCycle cycle) {
		setCount(getCount() + 1);	
	}
}

The count is updated one, from 0 to 1, but successive clicks keep the
counter on 1!

Thanks!

Ruud Diterwich


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