You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Hans Drexler <dr...@geotax.nl> on 2005/01/12 12:17:22 UTC

property initialization

I want to build a page with a form where a user can change her/his name. The
page displays a form with input fields for the users name (and password). I
would like the form to display the users current name. But this does not
happen. The field remains empty.
 
Can somebody please tell me what i am missing?

In a page file i have:

<page-specification class="myPackage.myPage">
    <property-specification name="username" class="java.lang.String" />
    <component id="aForm" type="Form"/>
    <component id="nameInput" type="TextField">
        <binding name="value" expression="username"/>
    </component>
    ...
</page-specification>

The page implements pageRenderListener to retrieve at runtime the current user
details. This code gets called and indeed seems to work. The debugger showed
the correct user name was put into the setName() method.

This is the .java file:

public abstract class myPage extends BasePage implements PageRenderListener {

  public abstract String getUsername();
  public abstract void setUsername(String s);

  public void pageBeginRender(PageEvent event) {
      Visit v = (Visit) getVisit();
      User p = v.getUser(); 
      setName(p.getName());
  }
  ...
}

Can somebody give me a hint? It looks like the TextField component for the
user name has already been rendered before the pageBeginRender() was invoked.

thanks!

----
Hans Drexler
GeoTax b.v.
e: drexler@geotax.nl


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


Re: property initialization

Posted by Hans Drexler <dr...@geotax.nl>.
On Wed, 12 Jan 2005 11:30:14 +0000 (GMT), Shing Hing Man wrote
> In your java code :
> >public abstract class myPage extends BasePage
> > implements PageRenderListener {
> > 
> >   public abstract String getUsername();
> >   public abstract void setUsername(String s);
> > 
> >   public void pageBeginRender(PageEvent event) {
> >       Visit v = (Visit) getVisit();
> >       User p = v.getUser(); 
> >       setName(p.getName());
> >   }
> 
> Shouldn't setName(p.getName()) be
>  setUsername(p.getName()) ?
> 

Thank you for your reply.

Yes, you are right. I tried to edit out all non-essential java code before
sending the e-mail. In the process this error was introduced. My apologies. 

The pageBeginRender() should be:

public void pageBeginRender(PageEvent event) {
     Visit v = (Visit) getVisit();
     User p = v.getUser();
     setUsername(p.getName());
 } 

Actually, I introduced another one as well in the page file:
class="java.lang.String" should be type="java.lang.String"

But that is not the source of my problem. My question is: why does my
application not show the current user name?

Actually, I added a simple insert on my page, like this:

The username is: <span jwcid="testit"/>

.page:
    <component id="testit" type="Insert">
        <binding name="value" expression="username"/>
    </component>

But it also shows an empty string.

why is that?



> Shing
> 
>  --- Hans Drexler <dr...@geotax.nl> wrote: 
> > 
> > I want to build a page with a form where a user can
> > change her/his name. The
> > page displays a form with input fields for the users
> > name (and password). I
> > would like the form to display the users current
> > name. But this does not
> > happen. The field remains empty.
> >  
> > Can somebody please tell me what i am missing?
> > 
> > In a page file i have:
> > 
> > <page-specification class="myPackage.myPage">
> >     <property-specification name="username"
> > class="java.lang.String" />
> >     <component id="aForm" type="Form"/>
> >     <component id="nameInput" type="TextField">
> >         <binding name="value"
> > expression="username"/>
> >     </component>
> >     ...
> > </page-specification>
> > 
> > The page implements pageRenderListener to retrieve
> > at runtime the current user
> > details. This code gets called and indeed seems to
> > work. The debugger showed
> > the correct user name was put into the setName()
> > method.
> > 
> > This is the .java file:
> > 
> > public abstract class myPage extends BasePage
> > implements PageRenderListener {
> > 
> >   public abstract String getUsername();
> >   public abstract void setUsername(String s);
> > 
> >   public void pageBeginRender(PageEvent event) {
> >       Visit v = (Visit) getVisit();
> >       User p = v.getUser(); 
> >       setName(p.getName());
> >   }
> >   ...
> > }
> > 
> > Can somebody give me a hint? It looks like the
> > TextField component for the
> > user name has already been rendered before the
> > pageBeginRender() was invoked.
> > 
> > thanks!
> > 
> > ----
> > Hans Drexler
> > GeoTax b.v.
> > e: drexler@geotax.nl
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tapestry-user-help@jakarta.apache.org
> > 
> >
> 
> =====
> Home page :
>   http://uk.geocities.com/matmsh/index.html
> 
> 	
> 	
> 		
> ___________________________________________________________ 
> ALL-NEW Yahoo! Messenger - all new features - even more fun!
http://uk.messenger.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


----
Hans Drexler
GeoTax b.v.
e: drexler@geotax.nl


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


Re: property initialization

Posted by Shing Hing Man <ma...@yahoo.com>.
In your java code :
>public abstract class myPage extends BasePage
> implements PageRenderListener {
> 
>   public abstract String getUsername();
>   public abstract void setUsername(String s);
> 
>   public void pageBeginRender(PageEvent event) {
>       Visit v = (Visit) getVisit();
>       User p = v.getUser(); 
>       setName(p.getName());
>   }

Shouldn't setName(p.getName()) be
 setUsername(p.getName()) ?

Shing



 --- Hans Drexler <dr...@geotax.nl> wrote: 
> 
> I want to build a page with a form where a user can
> change her/his name. The
> page displays a form with input fields for the users
> name (and password). I
> would like the form to display the users current
> name. But this does not
> happen. The field remains empty.
>  
> Can somebody please tell me what i am missing?
> 
> In a page file i have:
> 
> <page-specification class="myPackage.myPage">
>     <property-specification name="username"
> class="java.lang.String" />
>     <component id="aForm" type="Form"/>
>     <component id="nameInput" type="TextField">
>         <binding name="value"
> expression="username"/>
>     </component>
>     ...
> </page-specification>
> 
> The page implements pageRenderListener to retrieve
> at runtime the current user
> details. This code gets called and indeed seems to
> work. The debugger showed
> the correct user name was put into the setName()
> method.
> 
> This is the .java file:
> 
> public abstract class myPage extends BasePage
> implements PageRenderListener {
> 
>   public abstract String getUsername();
>   public abstract void setUsername(String s);
> 
>   public void pageBeginRender(PageEvent event) {
>       Visit v = (Visit) getVisit();
>       User p = v.getUser(); 
>       setName(p.getName());
>   }
>   ...
> }
> 
> Can somebody give me a hint? It looks like the
> TextField component for the
> user name has already been rendered before the
> pageBeginRender() was invoked.
> 
> thanks!
> 
> ----
> Hans Drexler
> GeoTax b.v.
> e: drexler@geotax.nl
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
>  

=====
Home page :
  http://uk.geocities.com/matmsh/index.html


	
	
		
___________________________________________________________ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

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