wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Gray <adam.j.g...@gmail.com>
Subject Re: Unusual problem is coming in rendering component
Date Wed, 02 May 2012 19:12:08 GMT
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.agarwal4@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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message