Quantcast

Unusual problem is coming in rendering component

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Unusual problem is coming in rendering component

kshitiz
This post was updated on .
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...?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Unusual problem is coming in rendering component

aksarben
It means it's looking for a method called getPostTextField() in your
model, but not finding one.




From:   kshitiz <[hidden email]>
To:     [hidden email]
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: [hidden email]
For additional commands, e-mail: [hidden email]




**

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.
**
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Unusual problem is coming in rendering component

Dan Retzlaff
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 <[hidden email]> wrote:

> It means it's looking for a method called getPostTextField() in your
> model, but not finding one.
>
>
>
>
> From:   kshitiz <[hidden email]>
> To:     [hidden email]
> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>
>
> **
>
> 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.
> **
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Unusual problem is coming in rendering component

Adam Gray
In reply to this post by kshitiz
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Unusual problem is coming in rendering component

kshitiz
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)???
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Unusual problem is coming in rendering component

Thomas Götz-2
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: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Unusual problem is coming in rendering component

kshitiz
I read that out...sorry I missed that while coding. Thanks for the help..:)
Loading...