You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by gcormier <ma...@tapestryforums.com> on 2005/12/14 19:40:11 UTC

TextField component issue.

Hi, I have a form to edit a department item.

Basically, you'll get a list of departments, and you can Add a new department, or edit/delete a department that you select with a radio button.

Adding a new department works fine - the page java sets the "selectedDepartment" parameter to a new Department() object, so all the default values are there.

Editing a department is not working. I'm getting a very strange error for 1 field. If I remove this field the form works great.

Where I have

/////
Department ID : 
/////

org.apache.tapestry.BindingException:  Parameter value (120) is an instance of java.lang.Long, which does not inherit from java.lang.String.


I'm not sure what I can do about this. selectedDepartment is the Object I'm working with, and editing this key which happens to be a Long is something I need to be able to do.

Is there a way around this, or am I doing something wrong?

Thanks,
Greg


-------------------- m2f --------------------

Sent from www.TapestryForums.com

Read this topic online here: <<topic_link>>

http://www.tapestryforums.com/viewtopic.php?p=11974#11974

-------------------- m2f --------------------



Re: TextField component issue.

Posted by Gunna Satria <gn...@nwa.iao.co.id>.
Hi,
the one that null is your selectedDepartment object.
you can see in your error message that when ognl tried to insert 2 to setId,
the referenced object is null.
maybe it is because your selectedDepartment object is null when the page is
rewinding, i suggest
you change your getSelectedDepartment method to,

public <your class> getSelectedDepartment(){
    if(null==selectedDepartment){
        selectedDeparment = new <your class>;
    }
    return selectedDepartment;
}

hope helps.
regards,

Gunna
----- Original Message -----
From: "gcormier" <ma...@tapestryforums.com>
To: <ta...@jakarta.apache.org>
Sent: Thursday, December 15, 2005 8:34 PM
Subject: RE: TextField component issue.

> org.apache.tapestry.BindingException
> Unable to update expression 'selectedDepartment.id'
>
> ognl.OgnlException
> target is null for setProperty(null, "id", 2)
>
>
> It points to my page file, the line with ** :


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


RE: TextField component issue.

Posted by gcormier <ma...@tapestryforums.com>.
Thanks, I indeed did not have the delegate setup properly :)

Now my form is displaying correctly, with the fields filled in of the department object! Wow! And it was relatively easy, and will be much easier to maintain then JSP :P

I'm still having some problems. I've added 2 buttons, OK and Cancel, and for now, all they do is a cycle.activate() back to the department's listing page, I'll deal with saving the department after which will be trivial as long as the attributes are getting set.

At the moment, when I hit Cancel I'm getting the following :

org.apache.tapestry.BindingException
Unable to update expression 'selectedDepartment.id'

ognl.OgnlException
target is null for setProperty(null, "id", 2)


It points to my page file, the line with ** :


  
  
**  



Further up I have my validator,


  
  
  "long"


Now I'm really stumped, because selectedDepartment.id is used to fill in the text box, so it obviously exists, and my Department class does have a setId(Long val) function...

Thanks,
Greg


-------------------- m2f --------------------

Sent from www.TapestryForums.com

Read this topic online here: <<topic_link>>

http://www.tapestryforums.com/viewtopic.php?p=12015#12015

-------------------- m2f --------------------



RE: TextField component issue.

Posted by gcormier <ma...@tapestryforums.com>.
Thanks, this fixed it up!!! :)  Setting it to persistent doesn't affect the re-use of objects or anything though right, so if another user came along they wouldn't have the information stored in that object?




Schulte Marcus wrote:
> Page-Properties in Tapestry are volatile by default. That means, they are
> only valid for one request. Try marking your department-property as
> "persistent" in the .page-specification
> 
> 



-------------------- m2f --------------------

Sent from www.TapestryForums.com

Read this topic online here: <<topic_link>>

http://www.tapestryforums.com/viewtopic.php?p=12069#12069

-------------------- m2f --------------------



Re: TextField component issue.

Posted by Gunna Satria <gn...@nwa.iao.co.id>.
Hi,
trying to help here.
i assume you add beans.delegate in form component.don't use static-binding
expression, use binding expression instead.
here is an example:
<bean name="delegate" class="org.apache.tapestry.valid.ValidationDelegate"
lifecycle="page"/>

<component id="form" type="Form">
<binding name="listener" expression="listeners.formSubmit"/>

<binding name="delegate" expression="beans.delegate"/>

</component>

<component id="myValidField" type="ValidField">

<binding name="value" expression="domainObject.someValue"/>

<static-binding name="displayName" value="'My Valid Field'"/>

<binding name="validator" expression="beans.intValidator"/>

<static-binding name="size" value="5"/>

<static-binding name="maxlength" value="4"/>

</component>


regards,

Gunna
----- Original Message -----
From: "gcormier" <ma...@tapestryforums.com>
To: <ta...@jakarta.apache.org>
Sent: Thursday, December 15, 2005 2:44 AM
Subject: RE: TextField component issue.


> Thank you both for your promt replies! I'm using 3.0, is there another
solution for 3.0 so if/when we upgraded it wouldn't be a problem?
>
>
> I changed it to ValidField and set some parameters, then got an error
about a delegate, so I added
>
>
>
>
>
>
>
>
>     "long"
>
>
> But now I'm still getting errors,
>
> org.apache.tapestry.param.ConnectedParameterException
> Unable to set property delegate of component EditDepartment/departmentForm
from StaticBinding[beans.delegate].
>
> org.apache.tapestry.BindingException
> Parameter delegate (beans.delegate) is an instance of java.lang.String,
which does not implement interface
org.apache.tapestry.valid.IValidationDelegate.
>
>
> What's the next step?
>
> Thanks,
> Greg
>
>
> -------------------- m2f --------------------
>
> Sent from www.TapestryForums.com
>
> Read this topic online here: <<topic_link>>
>
> http://www.tapestryforums.com/viewtopic.php?p=11980#11980
>
> -------------------- m2f --------------------
>
>
>


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


RE: TextField component issue.

Posted by gcormier <ma...@tapestryforums.com>.
Thank you both for your promt replies! I'm using 3.0, is there another solution for 3.0 so if/when we upgraded it wouldn't be a problem?


I changed it to ValidField and set some parameters, then got an error about a delegate, so I added

  

  


    
    
    "long"
	

But now I'm still getting errors,

org.apache.tapestry.param.ConnectedParameterException
Unable to set property delegate of component EditDepartment/departmentForm from StaticBinding[beans.delegate].

org.apache.tapestry.BindingException
Parameter delegate (beans.delegate) is an instance of java.lang.String, which does not implement interface org.apache.tapestry.valid.IValidationDelegate.


What's the next step?

Thanks,
Greg


-------------------- m2f --------------------

Sent from www.TapestryForums.com

Read this topic online here: <<topic_link>>

http://www.tapestryforums.com/viewtopic.php?p=11980#11980

-------------------- m2f --------------------



RE: TextField component issue.

Posted by Patrick Casey <pa...@adelphia.net>.
	User a ValidField instead of a TextField. TextFields only work with
string data types, while ValidFields use the validator to do data type
conversion between the displayed string and the appropriate internal data
type.


	--- Pat

> -----Original Message-----
> From: gcormier [mailto:maillist@tapestryforums.com]
> Sent: Wednesday, December 14, 2005 10:40 AM
> To: tapestry-user@jakarta.apache.org
> Subject: TextField component issue.
> 
> Hi, I have a form to edit a department item.
> 
> Basically, you'll get a list of departments, and you can Add a new
> department, or edit/delete a department that you select with a radio
> button.
> 
> Adding a new department works fine - the page java sets the
> "selectedDepartment" parameter to a new Department() object, so all the
> default values are there.
> 
> Editing a department is not working. I'm getting a very strange error for
> 1 field. If I remove this field the form works great.
> 
> Where I have
> 
> /////
> Department ID :
> /////
> 
> org.apache.tapestry.BindingException:  Parameter value (120) is an
> instance of java.lang.Long, which does not inherit from java.lang.String.
> 
> 
> I'm not sure what I can do about this. selectedDepartment is the Object
> I'm working with, and editing this key which happens to be a Long is
> something I need to be able to do.
> 
> Is there a way around this, or am I doing something wrong?
> 
> Thanks,
> Greg
> 
> 
> -------------------- m2f --------------------
> 
> Sent from www.TapestryForums.com
> 
> Read this topic online here: <<topic_link>>
> 
> http://www.tapestryforums.com/viewtopic.php?p=11974#11974
> 
> -------------------- m2f --------------------
> 




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