You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by gs...@smm.de on 2005/12/01 19:14:14 UTC

Now I am really confused :(

Hi, again :)

On my path exploring Tapestry 4.0b12 a new miracle appeared :(

Searching for the right place to get my component-property stored for the
current user (application-wide without creating a session (at this moment I
think it is impossible doing so with Tapestry :( )) , I was checking  the
ExternalLink component.

And here my current problem is:
-----------------------------------------------------
interface for easy implementation of the property in each page-class where
I need it:

public interface IXxxx extends IPage {

     public abstract void setXxxx(int xxxx) ;
     public abstract int getXxxx() ;

}
-----------------------------------------------------
the page class:

public abstract class MyPage extends BasePage implements IXxxx,
IExternalPage {

public void activateExternalPage(Object[] params, IRequestCycle cycle) {
     setXxxx(((Integer) params[0]).intValue()) ;
}

page-spezification:

<property name="xxxx"/>

-----------------------------------------------------
This Page contains 2 components:

component A:

<property name="myProperty" initial-value="ognl:getPage().getXxxx()"/>
and an @Insert-tag with value="ognl:myProperty"

component B:
an @Insert-tag with value="ognl:getPage().getXxxx()"


Component A produces a link: http://localhost:8080/MyApp/MyPage.ex?sp=1

After clicking this link, both components are displaying the value 1.

In the addess-field of the browser I change the service-parameter manually
to the new value of 2 and press return.

Component A displays the value 1, component B displays the value 2.

Hmmm .... I didn't expect this !!

And I can't figure out why this behaviour occurres .... could anyone give
me a hint ?

Starting a new browser-instance and copying the address-field (with sp=2)
in, pressing return results in both components displaying the value 2 ...

I am really confused, now ....

Thank you very much !!

Gerald Schöffel





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


Re: Now I am really confused :(

Posted by Kent Tong <ke...@cpttm.org.mo>.
 <gs <at> smm.de> writes:

> Searching for the right place to get my component-property stored for the
> current user (application-wide without creating a session (at this moment I
> think it is impossible doing so with Tapestry :( )) , I was checking  the
> ExternalLink component.

If you don't use sessions, how can you tell which user it is?

> component A:
> 
> <property name="myProperty" initial-value="ognl:getPage().getXxxx()"/>
> and an  <at> Insert-tag with value="ognl:myProperty"
> 
> component B:
> an  <at> Insert-tag with value="ognl:getPage().getXxxx()"
> 
> In the addess-field of the browser I change the service-parameter manually
> to the new value of 2 and press return.
> 
> Component A displays the value 1, component B displays the value 2.

This is normal. the initial-value is used only after the component
is loaded and before it is returned to the pool (along with the
page containing it). It is NOT used just before it is rendered.
In your case as the page is probably staying there, myProperty
will remain as 1 even though xxxx has been set to 2.

--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)


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