You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Luke Galea <lg...@gmmsolutions.com> on 2004/01/11 21:35:27 UTC

More on the form parameters problem

 More info on my problem: I think I'm missing something big here..
 
I have a component that is called from multiple places (as indicated
below)..
when the user clicks submit, on a successfull edit I want to send them
to a success page that is passed in by the calling page..
 
But in my listener, it seems like none of my bindings are set!! The only
way to access any of them is through getBinding() rather than through my
local bean properties with corresponding names..
 
Any ideas?
 
Thanks in advance!!

-----Original Message-----
From: Luke Galea [mailto:lgalea@gmmsolutions.com] 
Sent: January 10, 2004 12:08 PM
To: 'tapestry-user@jakarta.apache.org'
Subject: Form Parameters


Hello all,
 
I have a component that edits the properties of an object that is
included by several pages..
The object to be edited is passed in as a parameter and the component
renders a form with elements to represent several bean-properties of
that object..
 
When using the "form" parameter direction, upon submission of the form
the object is null...
So I have been forced to use "bindings.yada.object.property" in order to
get around it..
 
Is this a case where I need custom direction??
 
Thanks in advance!!


RE: More on the form parameters problem

Posted by Luke Galea <lg...@gmmsolutions.com>.
Okay.. So: now I am getting:

Unable to enhance class com.idollarz.components.useredit.UserEdit
because it implements a non-abstract write method for property
'successPage'.

What it says is true: I've implemented a standard setter that sets a
private String..

But shouldn't this work?

I managed to work around it by implementing abstract methods.. But my
question is:
When did it change such that parameters aren't just set at runtime (ie.
Calling my own setter implementation)??

In this case, I'm happy with the default implementation.. But is this
always required?

Thanks again for all your help.

-----Original Message-----
From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
Sent: January 11, 2004 9:03 PM
To: Tapestry users
Subject: Re: More on the form parameters problem


Simply change the user parameter to direction "auto".

<parameter name="user" type="com.idollarz.datamodel.User"
direction="auto" required="yes" />

Direction form is only for properties that are updated from the request
parameters. This parameter 
is actually updated from another parameter property (the ValidField's
value parameter).

-Harish


Luke Galea wrote:

> Thanks..
> 
> Okay..
> 
> I have a NewUser page and a UserEdit component..
> 
> NewUser has a single bean property called newUser..
> And includes the UserEdit component like this:
> <span jwcid="@UserEdit" user="ognl:newUser" 
> successPage="Home">UserEditComponent</span>
> 
> UserEdit.jwc starts out like this:
> 
> <component-specification 
> class="com.idollarz.components.useredit.UserEdit">
>     <parameter name="user" type="com.idollarz.datamodel.User"
> direction="form" required="yes"/>
>     <parameter name="successPage" type="java.lang.String" 
> direction="in" required="yes"/>
> 
> And then goes on to have a bunch of ValidFields like this:
> 
>  <component id="userNameField" type="ValidField">
>         <binding name="value" expression="user.postal"/>
>         <binding name="validator" expression="beans.textValidator"/>
>         <static-binding name="displayName" value="Requested
Username"/>
>     </component>
> 
> Note me accessing the user parameter for the value..
> 
> The form is defined by:
> 
> <form jwcid="@Form" listener="ognl:listeners.formSubmit"
> delegate="ognl:beans.delegate">
> 
> And the problem occurs in the formSubmit method:
> 
> public void formSubmit( IRequestCycle cycle )
>     {
>         try
>         {
>             System.err.println("Saving user");
>             
>             //Save the user
>             Database.saveObject( getUser(),
> getIDollarzPage().getSession() );
>             
>             //Make sure we are logged in as them in
>             getIDollarzVisit().setUser( getUser() );
>             
>             //Go to the successpage
>             cycle.setPage( getSuccessPage() );            
>         }
>         catch( Throwable t )
>         {            
>             throw new RuntimeException( t );
>         }        
>     }
> 
> The problem is: the user bean property is not being set..
> 
> I tried reimplementing the getUser method as:
> 
> 
> -----Original Message-----
> From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net]
> Sent: January 11, 2004 4:31 PM
> To: Tapestry users
> Subject: Re: More on the form parameters problem
> 
> 
> Perhaps posting some code would get you some answers.
> 
> -Harish
> 
> Luke Galea wrote:
> 
> 
>> More info on my problem: I think I'm missing something big here..
>> 
>>I have a component that is called from multiple places (as indicated
>>below).. when the user clicks submit, on a successfull edit I want to 
>>send them to a success page that is passed in by the calling page..
>> 
>>But in my listener, it seems like none of my bindings are set!! The
>>only way to access any of them is through getBinding() rather than 
>>through my local bean properties with corresponding names..
>> 
>>Any ideas?
>> 
>>Thanks in advance!!
>>
>>-----Original Message-----
>>From: Luke Galea [mailto:lgalea@gmmsolutions.com]
>>Sent: January 10, 2004 12:08 PM
>>To: 'tapestry-user@jakarta.apache.org'
>>Subject: Form Parameters
>>
>>
>>Hello all,
>> 
>>I have a component that edits the properties of an object that is
>>included by several pages.. The object to be edited is passed in as a 
>>parameter and the component renders a form with elements to represent 
>>several bean-properties of that object..
>> 
>>When using the "form" parameter direction, upon submission of the form
> 
> 
>>the object is null... So I have been forced to use
>>"bindings.yada.object.property" in order to get around it..
>> 
>>Is this a case where I need custom direction??
>> 
>>Thanks in advance!!
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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



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


RE: More on the form parameters problem

Posted by Luke Galea <lg...@gmmsolutions.com>.
Thanks again Harish..

The book looks great.. I'll definitely be picking that up.

Congrats to Howard on that btw!!!

-----Original Message-----
From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
Sent: January 12, 2004 8:42 PM
To: Tapestry users
Subject: Re: More on the form parameters problem




Luke Galea wrote:

> Thanks Harish!! I'll give that a try right now..
> 
> This leads into another problem..
> How on earth did you know that? Where is that property documented? Is 
> it new to 3.0?? Is there an incomplete 3.0 documentation somewhere 
> that I could use?

I have started working on the documentation that you may find at
http://myworkspace.sf.net although 
I haven't gotten that far yet. There are also other resources that you
may find in the wiki at 
http://tapestry.sourceforge.net/wiki/index.php/TapestryResources.

> 
> There are substantial differences between each version of tapestry.. 
> But as is recognized on the site, this documentation isn't up to 
> date..
> 
> I've been finding that the only way to keep up is to look at the 
> examples and see if I can find a difference from the previous version.
> 
> Is there a better way?

You have the mail archive at gmane.org that is an excellent source, also
Howard's book "Tapestry In 
Action" is available in MEAP at manning.com

-Harish

> 
> -----Original Message-----
> From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net]
> Sent: January 11, 2004 9:03 PM
> To: Tapestry users
> Subject: Re: More on the form parameters problem
> 
> 
> Simply change the user parameter to direction "auto".
> 
> <parameter name="user" type="com.idollarz.datamodel.User"
> direction="auto" required="yes" />
> 
> Direction form is only for properties that are updated from the 
> request parameters. This parameter is actually updated from another 
> parameter property (the ValidField's value parameter).
> 
> -Harish
> 
> 
> Luke Galea wrote:
> 
> 
>>Thanks..
>>
>>Okay..
>>
>>I have a NewUser page and a UserEdit component..
>>
>>NewUser has a single bean property called newUser..
>>And includes the UserEdit component like this:
>><span jwcid="@UserEdit" user="ognl:newUser"
>>successPage="Home">UserEditComponent</span>
>>
>>UserEdit.jwc starts out like this:
>>
>><component-specification
>>class="com.idollarz.components.useredit.UserEdit">
>>    <parameter name="user" type="com.idollarz.datamodel.User"
>>direction="form" required="yes"/>
>>    <parameter name="successPage" type="java.lang.String" 
>>direction="in" required="yes"/>
>>
>>And then goes on to have a bunch of ValidFields like this:
>>
>> <component id="userNameField" type="ValidField">
>>        <binding name="value" expression="user.postal"/>
>>        <binding name="validator" expression="beans.textValidator"/>
>>        <static-binding name="displayName" value="Requested
> 
> Username"/>
> 
>>    </component>
>>
>>Note me accessing the user parameter for the value..
>>
>>The form is defined by:
>>
>><form jwcid="@Form" listener="ognl:listeners.formSubmit"
>>delegate="ognl:beans.delegate">
>>
>>And the problem occurs in the formSubmit method:
>>
>>public void formSubmit( IRequestCycle cycle )
>>    {
>>        try
>>        {
>>            System.err.println("Saving user");
>>            
>>            //Save the user
>>            Database.saveObject( getUser(),
>>getIDollarzPage().getSession() );
>>            
>>            //Make sure we are logged in as them in
>>            getIDollarzVisit().setUser( getUser() );
>>            
>>            //Go to the successpage
>>            cycle.setPage( getSuccessPage() );            
>>        }
>>        catch( Throwable t )
>>        {            
>>            throw new RuntimeException( t );
>>        }        
>>    }
>>
>>The problem is: the user bean property is not being set..
>>
>>I tried reimplementing the getUser method as:
>>
>>
>>-----Original Message-----
>>From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net]
>>Sent: January 11, 2004 4:31 PM
>>To: Tapestry users
>>Subject: Re: More on the form parameters problem
>>
>>
>>Perhaps posting some code would get you some answers.
>>
>>-Harish
>>
>>Luke Galea wrote:
>>
>>
>>
>>>More info on my problem: I think I'm missing something big here..
>>>
>>>I have a component that is called from multiple places (as indicated 
>>>below).. when the user clicks submit, on a successfull edit I want to

>>>send them to a success page that is passed in by the calling page..
>>>
>>>But in my listener, it seems like none of my bindings are set!! The 
>>>only way to access any of them is through getBinding() rather than 
>>>through my local bean properties with corresponding names..
>>>
>>>Any ideas?
>>>
>>>Thanks in advance!!
>>>
>>>-----Original Message-----
>>>From: Luke Galea [mailto:lgalea@gmmsolutions.com]
>>>Sent: January 10, 2004 12:08 PM
>>>To: 'tapestry-user@jakarta.apache.org'
>>>Subject: Form Parameters
>>>
>>>
>>>Hello all,
>>>
>>>I have a component that edits the properties of an object that is 
>>>included by several pages.. The object to be edited is passed in as a

>>>parameter and the component renders a form with elements to represent

>>>several bean-properties of that object..
>>>
>>>When using the "form" parameter direction, upon submission of the 
>>>form
>>
>>
>>>the object is null... So I have been forced to use 
>>>"bindings.yada.object.property" in order to get around it..
>>>
>>>Is this a case where I need custom direction??
>>>
>>>Thanks in advance!!
>>>
>>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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



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


Re: More on the form parameters problem

Posted by Harish Krishnaswamy <hk...@comcast.net>.

Luke Galea wrote:

> Thanks Harish!! I'll give that a try right now..
> 
> This leads into another problem..
> How on earth did you know that? Where is that property documented? Is it
> new to 3.0??
> Is there an incomplete 3.0 documentation somewhere that I could use?

I have started working on the documentation that you may find at http://myworkspace.sf.net although 
I haven't gotten that far yet. There are also other resources that you may find in the wiki at 
http://tapestry.sourceforge.net/wiki/index.php/TapestryResources.

> 
> There are substantial differences between each version of tapestry.. But
> as is recognized on the site, this documentation isn't up to date..
> 
> I've been finding that the only way to keep up is to look at the
> examples and see if I can find a difference from the previous version.
> 
> Is there a better way?

You have the mail archive at gmane.org that is an excellent source, also Howard's book "Tapestry In 
Action" is available in MEAP at manning.com

-Harish

> 
> -----Original Message-----
> From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
> Sent: January 11, 2004 9:03 PM
> To: Tapestry users
> Subject: Re: More on the form parameters problem
> 
> 
> Simply change the user parameter to direction "auto".
> 
> <parameter name="user" type="com.idollarz.datamodel.User"
> direction="auto" required="yes" />
> 
> Direction form is only for properties that are updated from the request
> parameters. This parameter 
> is actually updated from another parameter property (the ValidField's
> value parameter).
> 
> -Harish
> 
> 
> Luke Galea wrote:
> 
> 
>>Thanks..
>>
>>Okay..
>>
>>I have a NewUser page and a UserEdit component..
>>
>>NewUser has a single bean property called newUser..
>>And includes the UserEdit component like this:
>><span jwcid="@UserEdit" user="ognl:newUser" 
>>successPage="Home">UserEditComponent</span>
>>
>>UserEdit.jwc starts out like this:
>>
>><component-specification 
>>class="com.idollarz.components.useredit.UserEdit">
>>    <parameter name="user" type="com.idollarz.datamodel.User"
>>direction="form" required="yes"/>
>>    <parameter name="successPage" type="java.lang.String" 
>>direction="in" required="yes"/>
>>
>>And then goes on to have a bunch of ValidFields like this:
>>
>> <component id="userNameField" type="ValidField">
>>        <binding name="value" expression="user.postal"/>
>>        <binding name="validator" expression="beans.textValidator"/>
>>        <static-binding name="displayName" value="Requested
> 
> Username"/>
> 
>>    </component>
>>
>>Note me accessing the user parameter for the value..
>>
>>The form is defined by:
>>
>><form jwcid="@Form" listener="ognl:listeners.formSubmit"
>>delegate="ognl:beans.delegate">
>>
>>And the problem occurs in the formSubmit method:
>>
>>public void formSubmit( IRequestCycle cycle )
>>    {
>>        try
>>        {
>>            System.err.println("Saving user");
>>            
>>            //Save the user
>>            Database.saveObject( getUser(),
>>getIDollarzPage().getSession() );
>>            
>>            //Make sure we are logged in as them in
>>            getIDollarzVisit().setUser( getUser() );
>>            
>>            //Go to the successpage
>>            cycle.setPage( getSuccessPage() );            
>>        }
>>        catch( Throwable t )
>>        {            
>>            throw new RuntimeException( t );
>>        }        
>>    }
>>
>>The problem is: the user bean property is not being set..
>>
>>I tried reimplementing the getUser method as:
>>
>>
>>-----Original Message-----
>>From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net]
>>Sent: January 11, 2004 4:31 PM
>>To: Tapestry users
>>Subject: Re: More on the form parameters problem
>>
>>
>>Perhaps posting some code would get you some answers.
>>
>>-Harish
>>
>>Luke Galea wrote:
>>
>>
>>
>>>More info on my problem: I think I'm missing something big here..
>>>
>>>I have a component that is called from multiple places (as indicated
>>>below).. when the user clicks submit, on a successfull edit I want to 
>>>send them to a success page that is passed in by the calling page..
>>>
>>>But in my listener, it seems like none of my bindings are set!! The
>>>only way to access any of them is through getBinding() rather than 
>>>through my local bean properties with corresponding names..
>>>
>>>Any ideas?
>>>
>>>Thanks in advance!!
>>>
>>>-----Original Message-----
>>>From: Luke Galea [mailto:lgalea@gmmsolutions.com]
>>>Sent: January 10, 2004 12:08 PM
>>>To: 'tapestry-user@jakarta.apache.org'
>>>Subject: Form Parameters
>>>
>>>
>>>Hello all,
>>>
>>>I have a component that edits the properties of an object that is
>>>included by several pages.. The object to be edited is passed in as a 
>>>parameter and the component renders a form with elements to represent 
>>>several bean-properties of that object..
>>>
>>>When using the "form" parameter direction, upon submission of the form
>>
>>
>>>the object is null... So I have been forced to use
>>>"bindings.yada.object.property" in order to get around it..
>>>
>>>Is this a case where I need custom direction??
>>>
>>>Thanks in advance!!
>>>
>>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


RE: More on the form parameters problem

Posted by Luke Galea <lg...@gmmsolutions.com>.
Thanks Harish!! I'll give that a try right now..

This leads into another problem..
How on earth did you know that? Where is that property documented? Is it
new to 3.0??
Is there an incomplete 3.0 documentation somewhere that I could use?

There are substantial differences between each version of tapestry.. But
as is recognized on the site, this documentation isn't up to date..

I've been finding that the only way to keep up is to look at the
examples and see if I can find a difference from the previous version.

Is there a better way?

-----Original Message-----
From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
Sent: January 11, 2004 9:03 PM
To: Tapestry users
Subject: Re: More on the form parameters problem


Simply change the user parameter to direction "auto".

<parameter name="user" type="com.idollarz.datamodel.User"
direction="auto" required="yes" />

Direction form is only for properties that are updated from the request
parameters. This parameter 
is actually updated from another parameter property (the ValidField's
value parameter).

-Harish


Luke Galea wrote:

> Thanks..
> 
> Okay..
> 
> I have a NewUser page and a UserEdit component..
> 
> NewUser has a single bean property called newUser..
> And includes the UserEdit component like this:
> <span jwcid="@UserEdit" user="ognl:newUser" 
> successPage="Home">UserEditComponent</span>
> 
> UserEdit.jwc starts out like this:
> 
> <component-specification 
> class="com.idollarz.components.useredit.UserEdit">
>     <parameter name="user" type="com.idollarz.datamodel.User"
> direction="form" required="yes"/>
>     <parameter name="successPage" type="java.lang.String" 
> direction="in" required="yes"/>
> 
> And then goes on to have a bunch of ValidFields like this:
> 
>  <component id="userNameField" type="ValidField">
>         <binding name="value" expression="user.postal"/>
>         <binding name="validator" expression="beans.textValidator"/>
>         <static-binding name="displayName" value="Requested
Username"/>
>     </component>
> 
> Note me accessing the user parameter for the value..
> 
> The form is defined by:
> 
> <form jwcid="@Form" listener="ognl:listeners.formSubmit"
> delegate="ognl:beans.delegate">
> 
> And the problem occurs in the formSubmit method:
> 
> public void formSubmit( IRequestCycle cycle )
>     {
>         try
>         {
>             System.err.println("Saving user");
>             
>             //Save the user
>             Database.saveObject( getUser(),
> getIDollarzPage().getSession() );
>             
>             //Make sure we are logged in as them in
>             getIDollarzVisit().setUser( getUser() );
>             
>             //Go to the successpage
>             cycle.setPage( getSuccessPage() );            
>         }
>         catch( Throwable t )
>         {            
>             throw new RuntimeException( t );
>         }        
>     }
> 
> The problem is: the user bean property is not being set..
> 
> I tried reimplementing the getUser method as:
> 
> 
> -----Original Message-----
> From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net]
> Sent: January 11, 2004 4:31 PM
> To: Tapestry users
> Subject: Re: More on the form parameters problem
> 
> 
> Perhaps posting some code would get you some answers.
> 
> -Harish
> 
> Luke Galea wrote:
> 
> 
>> More info on my problem: I think I'm missing something big here..
>> 
>>I have a component that is called from multiple places (as indicated
>>below).. when the user clicks submit, on a successfull edit I want to 
>>send them to a success page that is passed in by the calling page..
>> 
>>But in my listener, it seems like none of my bindings are set!! The
>>only way to access any of them is through getBinding() rather than 
>>through my local bean properties with corresponding names..
>> 
>>Any ideas?
>> 
>>Thanks in advance!!
>>
>>-----Original Message-----
>>From: Luke Galea [mailto:lgalea@gmmsolutions.com]
>>Sent: January 10, 2004 12:08 PM
>>To: 'tapestry-user@jakarta.apache.org'
>>Subject: Form Parameters
>>
>>
>>Hello all,
>> 
>>I have a component that edits the properties of an object that is
>>included by several pages.. The object to be edited is passed in as a 
>>parameter and the component renders a form with elements to represent 
>>several bean-properties of that object..
>> 
>>When using the "form" parameter direction, upon submission of the form
> 
> 
>>the object is null... So I have been forced to use
>>"bindings.yada.object.property" in order to get around it..
>> 
>>Is this a case where I need custom direction??
>> 
>>Thanks in advance!!
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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



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


Re: More on the form parameters problem

Posted by Harish Krishnaswamy <hk...@comcast.net>.
Simply change the user parameter to direction "auto".

<parameter name="user" type="com.idollarz.datamodel.User" direction="auto" required="yes" />

Direction form is only for properties that are updated from the request parameters. This parameter 
is actually updated from another parameter property (the ValidField's value parameter).

-Harish


Luke Galea wrote:

> Thanks..
> 
> Okay.. 
> 
> I have a NewUser page and a UserEdit component..
> 
> NewUser has a single bean property called newUser..
> And includes the UserEdit component like this:
> <span jwcid="@UserEdit" user="ognl:newUser"
> successPage="Home">UserEditComponent</span>
> 
> UserEdit.jwc starts out like this:
> 
> <component-specification
> class="com.idollarz.components.useredit.UserEdit">
>     <parameter name="user" type="com.idollarz.datamodel.User"
> direction="form" required="yes"/>
>     <parameter name="successPage" type="java.lang.String" direction="in"
> required="yes"/>
> 
> And then goes on to have a bunch of ValidFields like this:
> 
>  <component id="userNameField" type="ValidField">
>         <binding name="value" expression="user.postal"/>
>         <binding name="validator" expression="beans.textValidator"/>
>         <static-binding name="displayName" value="Requested Username"/>
>     </component>
> 
> Note me accessing the user parameter for the value..
> 
> The form is defined by:
> 
> <form jwcid="@Form" listener="ognl:listeners.formSubmit"
> delegate="ognl:beans.delegate">
> 
> And the problem occurs in the formSubmit method:
> 
> public void formSubmit( IRequestCycle cycle )
>     {
>         try
>         {
>             System.err.println("Saving user");
>             
>             //Save the user
>             Database.saveObject( getUser(),
> getIDollarzPage().getSession() );
>             
>             //Make sure we are logged in as them in
>             getIDollarzVisit().setUser( getUser() );
>             
>             //Go to the successpage
>             cycle.setPage( getSuccessPage() );            
>         }
>         catch( Throwable t )
>         {            
>             throw new RuntimeException( t );
>         }        
>     }
> 
> The problem is: the user bean property is not being set..
> 
> I tried reimplementing the getUser method as:
> 
> 
> -----Original Message-----
> From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
> Sent: January 11, 2004 4:31 PM
> To: Tapestry users
> Subject: Re: More on the form parameters problem
> 
> 
> Perhaps posting some code would get you some answers.
> 
> -Harish
> 
> Luke Galea wrote:
> 
> 
>> More info on my problem: I think I'm missing something big here..
>> 
>>I have a component that is called from multiple places (as indicated 
>>below).. when the user clicks submit, on a successfull edit I want to 
>>send them to a success page that is passed in by the calling page..
>> 
>>But in my listener, it seems like none of my bindings are set!! The 
>>only way to access any of them is through getBinding() rather than 
>>through my local bean properties with corresponding names..
>> 
>>Any ideas?
>> 
>>Thanks in advance!!
>>
>>-----Original Message-----
>>From: Luke Galea [mailto:lgalea@gmmsolutions.com]
>>Sent: January 10, 2004 12:08 PM
>>To: 'tapestry-user@jakarta.apache.org'
>>Subject: Form Parameters
>>
>>
>>Hello all,
>> 
>>I have a component that edits the properties of an object that is 
>>included by several pages.. The object to be edited is passed in as a 
>>parameter and the component renders a form with elements to represent 
>>several bean-properties of that object..
>> 
>>When using the "form" parameter direction, upon submission of the form
> 
> 
>>the object is null... So I have been forced to use 
>>"bindings.yada.object.property" in order to get around it..
>> 
>>Is this a case where I need custom direction??
>> 
>>Thanks in advance!!
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


RE: More on the form parameters problem

Posted by Luke Galea <lg...@gmmsolutions.com>.
Thanks..

Okay.. 

I have a NewUser page and a UserEdit component..

NewUser has a single bean property called newUser..
And includes the UserEdit component like this:
<span jwcid="@UserEdit" user="ognl:newUser"
successPage="Home">UserEditComponent</span>

UserEdit.jwc starts out like this:

<component-specification
class="com.idollarz.components.useredit.UserEdit">
    <parameter name="user" type="com.idollarz.datamodel.User"
direction="form" required="yes"/>
    <parameter name="successPage" type="java.lang.String" direction="in"
required="yes"/>

And then goes on to have a bunch of ValidFields like this:

 <component id="userNameField" type="ValidField">
        <binding name="value" expression="user.postal"/>
        <binding name="validator" expression="beans.textValidator"/>
        <static-binding name="displayName" value="Requested Username"/>
    </component>

Note me accessing the user parameter for the value..

The form is defined by:

<form jwcid="@Form" listener="ognl:listeners.formSubmit"
delegate="ognl:beans.delegate">

And the problem occurs in the formSubmit method:

public void formSubmit( IRequestCycle cycle )
    {
        try
        {
            System.err.println("Saving user");
            
            //Save the user
            Database.saveObject( getUser(),
getIDollarzPage().getSession() );
            
            //Make sure we are logged in as them in
            getIDollarzVisit().setUser( getUser() );
            
            //Go to the successpage
            cycle.setPage( getSuccessPage() );            
        }
        catch( Throwable t )
        {            
            throw new RuntimeException( t );
        }        
    }

The problem is: the user bean property is not being set..

I tried reimplementing the getUser method as:


-----Original Message-----
From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net] 
Sent: January 11, 2004 4:31 PM
To: Tapestry users
Subject: Re: More on the form parameters problem


Perhaps posting some code would get you some answers.

-Harish

Luke Galea wrote:

>  More info on my problem: I think I'm missing something big here..
>  
> I have a component that is called from multiple places (as indicated 
> below).. when the user clicks submit, on a successfull edit I want to 
> send them to a success page that is passed in by the calling page..
>  
> But in my listener, it seems like none of my bindings are set!! The 
> only way to access any of them is through getBinding() rather than 
> through my local bean properties with corresponding names..
>  
> Any ideas?
>  
> Thanks in advance!!
> 
> -----Original Message-----
> From: Luke Galea [mailto:lgalea@gmmsolutions.com]
> Sent: January 10, 2004 12:08 PM
> To: 'tapestry-user@jakarta.apache.org'
> Subject: Form Parameters
> 
> 
> Hello all,
>  
> I have a component that edits the properties of an object that is 
> included by several pages.. The object to be edited is passed in as a 
> parameter and the component renders a form with elements to represent 
> several bean-properties of that object..
>  
> When using the "form" parameter direction, upon submission of the form

> the object is null... So I have been forced to use 
> "bindings.yada.object.property" in order to get around it..
>  
> Is this a case where I need custom direction??
>  
> Thanks in advance!!
> 
> 


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



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


Re: More on the form parameters problem

Posted by Harish Krishnaswamy <hk...@comcast.net>.
Perhaps posting some code would get you some answers.

-Harish

Luke Galea wrote:

>  More info on my problem: I think I'm missing something big here..
>  
> I have a component that is called from multiple places (as indicated
> below)..
> when the user clicks submit, on a successfull edit I want to send them
> to a success page that is passed in by the calling page..
>  
> But in my listener, it seems like none of my bindings are set!! The only
> way to access any of them is through getBinding() rather than through my
> local bean properties with corresponding names..
>  
> Any ideas?
>  
> Thanks in advance!!
> 
> -----Original Message-----
> From: Luke Galea [mailto:lgalea@gmmsolutions.com] 
> Sent: January 10, 2004 12:08 PM
> To: 'tapestry-user@jakarta.apache.org'
> Subject: Form Parameters
> 
> 
> Hello all,
>  
> I have a component that edits the properties of an object that is
> included by several pages..
> The object to be edited is passed in as a parameter and the component
> renders a form with elements to represent several bean-properties of
> that object..
>  
> When using the "form" parameter direction, upon submission of the form
> the object is null...
> So I have been forced to use "bindings.yada.object.property" in order to
> get around it..
>  
> Is this a case where I need custom direction??
>  
> Thanks in advance!!
> 
> 


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