You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kshitiz <k....@gmail.com> on 2012/05/02 21:07:35 UTC

Unusual problem is coming in rendering component

Hi,

I am trying to render a text field :

Java code:

*final RequiredTextField<String> postTextField = new
RequiredTextField<String>(
				"postTextField");

*postForm.add(postTextField);*

Html code
*<input type="text" id="postTextField" wicket:id="postTextField"/>*

But I am gettin the error:

Root cause:

org.apache.wicket.WicketRuntimeException: No get method defined for class:
class domain.PostDomain expression: postTextField
     at
org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:499)
     at
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:341)
     at
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:244)
     at
org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:97)
     at
org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:134)
     at
org.apache.wicket.Component.getDefaultModelObject(Component.java:1668)
     at
org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1695)
     at
org.apache.wicket.markup.html.form.FormComponent.getModelValue(FormComponent.java:1211)
     at
org.apache.wicket.markup.html.form.FormComponent.getValue(FormComponent.java:837)
     at
org.apache.wicket.markup.html.form.TextField.onComponentTag(TextField.java:108)
     at
org.apache.wicket.Component.internalRenderComponent(Component.java:2510)
     at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1534)
     at org.apache.wicket.Component.internalRender(Component.java:2369)
     at org.apache.wicket.Component.render(Component.java:2297)

Now, when I replace *postTextField* with *post*, no error comes...!!!

That is, if my java code is:
*final RequiredTextField<String> postTextField = new
RequiredTextField<String>(
				"post");

and Html code is:

*<input type="text" id="postTextField" wicket:id="post"/>*

The code runs fine...

What can be the problem...?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unusual-problem-is-coming-in-rendering-component-tp4604163.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Unusual problem is coming in rendering component

Posted by Dan Retzlaff <dr...@gmail.com>.
I'd guess that you're using CompoundPropertyModel. This kind of confusion
is common with CPM, which is why people often recommend against it.

On Wed, May 2, 2012 at 12:09 PM, Richard W. Adams <RW...@up.com> wrote:

> It means it's looking for a method called getPostTextField() in your
> model, but not finding one.
>
>
>
>
> From:   kshitiz <k....@gmail.com>
> To:     users@wicket.apache.org
> Date:   05/02/2012 02:08 PM
> Subject:        Unusual problem is coming in rendering component
>
>
>
> Hi,
>
> I am trying to render a text field :
>
> Java code:
>
> *final RequiredTextField<String> postTextField = new
> RequiredTextField<String>(
>  "postTextField");
>
> *postForm.add(postTextField);*
>
> Html code
> *<input type="text" id="postTextField" wicket:id="postTextField"/>*
>
> But I am gettin the error:
>
> Root cause:
>
> org.apache.wicket.WicketRuntimeException: No get method defined for class:
> class domain.PostDomain expression: postTextField
>     at
>
> org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:499)
>     at
>
> org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:341)
>     at
>
> org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:244)
>     at
>
> org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:97)
>     at
>
> org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:134)
>     at
> org.apache.wicket.Component.getDefaultModelObject(Component.java:1668)
>     at
>
> org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1695)
>     at
>
> org.apache.wicket.markup.html.form.FormComponent.getModelValue(FormComponent.java:1211)
>     at
>
> org.apache.wicket.markup.html.form.FormComponent.getValue(FormComponent.java:837)
>     at
>
> org.apache.wicket.markup.html.form.TextField.onComponentTag(TextField.java:108)
>     at
> org.apache.wicket.Component.internalRenderComponent(Component.java:2510)
>     at
> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1534)
>     at org.apache.wicket.Component.internalRender(Component.java:2369)
>     at org.apache.wicket.Component.render(Component.java:2297)
>
> Now, when I replace *postTextField* with *post*, no error comes...!!!
>
> That is, if my java code is:
> *final RequiredTextField<String> postTextField = new
> RequiredTextField<String>(
>                                                                 "post");
>
> and Html code is:
>
> *<input type="text" id="postTextField" wicket:id="post"/>*
>
> The code runs fine...
>
> What can be the problem...?
>
>
>
> --
> View this message in context:
>
> http://apache-wicket.1842946.n4.nabble.com/Unusual-problem-is-coming-in-rendering-component-tp4604163.html
>
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
> **
>
> This email and any attachments may contain information that is
> confidential and/or privileged for the sole use of the intended recipient.
>  Any use, review, disclosure, copying, distribution or reliance by others,
> and any forwarding of this email or its contents, without the express
> permission of the sender is strictly prohibited by law.  If you are not the
> intended recipient, please contact the sender immediately, delete the
> e-mail and destroy all copies.
> **
>

Re: Unusual problem is coming in rendering component

Posted by "Richard W. Adams" <RW...@UP.COM>.
It means it's looking for a method called getPostTextField() in your 
model, but not finding one.




From:   kshitiz <k....@gmail.com>
To:     users@wicket.apache.org
Date:   05/02/2012 02:08 PM
Subject:        Unusual problem is coming in rendering component



Hi,

I am trying to render a text field :

Java code:

*final RequiredTextField<String> postTextField = new
RequiredTextField<String>(
 "postTextField");

*postForm.add(postTextField);*

Html code
*<input type="text" id="postTextField" wicket:id="postTextField"/>*

But I am gettin the error:

Root cause:

org.apache.wicket.WicketRuntimeException: No get method defined for class:
class domain.PostDomain expression: postTextField
     at
org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:499)
     at
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:341)
     at
org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:244)
     at
org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:97)
     at
org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:134)
     at
org.apache.wicket.Component.getDefaultModelObject(Component.java:1668)
     at
org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1695)
     at
org.apache.wicket.markup.html.form.FormComponent.getModelValue(FormComponent.java:1211)
     at
org.apache.wicket.markup.html.form.FormComponent.getValue(FormComponent.java:837)
     at
org.apache.wicket.markup.html.form.TextField.onComponentTag(TextField.java:108)
     at
org.apache.wicket.Component.internalRenderComponent(Component.java:2510)
     at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1534)
     at org.apache.wicket.Component.internalRender(Component.java:2369)
     at org.apache.wicket.Component.render(Component.java:2297)

Now, when I replace *postTextField* with *post*, no error comes...!!!

That is, if my java code is:
*final RequiredTextField<String> postTextField = new
RequiredTextField<String>(
                                                                 "post");

and Html code is:

*<input type="text" id="postTextField" wicket:id="post"/>*

The code runs fine...

What can be the problem...?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Unusual-problem-is-coming-in-rendering-component-tp4604163.html

Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org




**

This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law.  If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**

Re: Unusual problem is coming in rendering component

Posted by kshitiz <k....@gmail.com>.
I read that out...sorry I missed that while coding. Thanks for the help..:)

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unusual-problem-is-coming-in-rendering-component-tp4604163p4607651.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Unusual problem is coming in rendering component

Posted by Thomas Götz <to...@decoded.de>.
Please have a look at the JavaDoc of org.apache.wicket.model.CompoundPropertyModel. Other interesting reads:

https://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-CompoundPropertyModels
http://www.mkyong.com/wicket/wicket-compoundpropertymodel-example/

Cheers,
   -Tom




On 03.05.2012 at 05:07 kshitiz wrote:

> Thank you very much for the replies....I got the problem and solved it using
> the code:
> 
> *final RequiredTextField<String> postTextField = new
> RequiredTextField<String>(
> 				"postTextField", Model.of(postDomain.getPost()));
> *
> 
> But please tell me one thing...the first parameter in new
> RequiredTextField<String>() function is used to map textfield tag present in
> html page with its java definition. Why wicket is using that parameter to
> map it to the property of compound model (PostDomain in this case)???
> 
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unusual-problem-is-coming-in-rendering-component-tp4604163p4605012.html
> Sent from the Users forum mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Unusual problem is coming in rendering component

Posted by kshitiz <k....@gmail.com>.
Thank you very much for the replies....I got the problem and solved it using
the code:

*final RequiredTextField<String> postTextField = new
RequiredTextField<String>(
				"postTextField", Model.of(postDomain.getPost()));
*

But please tell me one thing...the first parameter in new
RequiredTextField<String>() function is used to map textfield tag present in
html page with its java definition. Why wicket is using that parameter to
map it to the property of compound model (PostDomain in this case)???

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Unusual-problem-is-coming-in-rendering-component-tp4604163p4605012.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Unusual problem is coming in rendering component

Posted by Adam Gray <ad...@gmail.com>.
It looks that since you aren't giving the text field a model to bind to,
it's walking up the component hierarchy to find a model to check for a
getter getPostTextField().  I'm guessing that PostDomain does have a
getPost() method, which it's finding and using.  You'll either want to keep
the wicket id as post, or give the text field an explicit property model
like, new PropertyModel<String>(form.getModel(), "post") as the second
argument to the text field constructor (assuming you are providing the form
with the model for PostDomain).

On Wed, May 2, 2012 at 3:07 PM, kshitiz <k....@gmail.com> wrote:

> Hi,
>
> I am trying to render a text field :
>
> Java code:
>
> *final RequiredTextField<String> postTextField = new
> RequiredTextField<String>(
>                                "postTextField");
>
> *postForm.add(postTextField);*
>
> Html code
> *<input type="text" id="postTextField" wicket:id="postTextField"/>*
>
> But I am gettin the error:
>
> Root cause:
>
> org.apache.wicket.WicketRuntimeException: No get method defined for class:
> class domain.PostDomain expression: postTextField
>     at
>
> org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:499)
>     at
>
> org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:341)
>     at
>
> org.apache.wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:244)
>     at
>
> org.apache.wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:97)
>     at
>
> org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyModel.java:134)
>     at
> org.apache.wicket.Component.getDefaultModelObject(Component.java:1668)
>     at
>
> org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1695)
>     at
>
> org.apache.wicket.markup.html.form.FormComponent.getModelValue(FormComponent.java:1211)
>     at
>
> org.apache.wicket.markup.html.form.FormComponent.getValue(FormComponent.java:837)
>     at
>
> org.apache.wicket.markup.html.form.TextField.onComponentTag(TextField.java:108)
>     at
> org.apache.wicket.Component.internalRenderComponent(Component.java:2510)
>     at
> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1534)
>     at org.apache.wicket.Component.internalRender(Component.java:2369)
>     at org.apache.wicket.Component.render(Component.java:2297)
>
> Now, when I replace *postTextField* with *post*, no error comes...!!!
>
> That is, if my java code is:
> *final RequiredTextField<String> postTextField = new
> RequiredTextField<String>(
>                                "post");
>
> and Html code is:
>
> *<input type="text" id="postTextField" wicket:id="post"/>*
>
> The code runs fine...
>
> What can be the problem...?
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Unusual-problem-is-coming-in-rendering-component-tp4604163.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>