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/03/18 09:55:59 UTC
Wicket 1.5 error : cannot find component id
Hi,
I am a new user in wicket world. I am facing a very common problem of which
I have found many solutions but none of those helped me out...:(. My html
page is:
<body>
<form wicket:id="registerForm">
<div>
<label for="name" wicket:id="nameLabel">Name</label> <input
type="text" id="name" wicket:id="name"/>
<input type="submit" value="Save" class="formbutton"
name="save" wicket:id="submitButton"/>
</div>
</form>
</body>
and My java class is:
public class Register extends WebPage{
private String name;
public Register()
{
Form<Register> registerForm = new Form<Register>("registerForm", new
CompoundPropertyModel<Register>(this));
add(registerForm);
Label nameLabel = new Label("nameLabel", "Name"); // (2)
registerForm.add(nameLabel);
TextField<String> nameField = new TextField<String>("name"); //
(3)
registerForm.add(nameField);
@SuppressWarnings("serial")
Button submitButton = new Button("submitButton") { // (4)
@Override
public void onSubmit() {
System.out.println("OnSubmit, name = " + name);
}
};
registerForm.add(submitButton);
}
}
I am getting the error:
*Unable to find component with id 'registerForm' in [Page class =
WalknShine.Register.Register, id = 3, render count = 1]
Expected: '.registerForm'.
Found with similar names: ''
MarkupStream: [markup =
file:/D:/WalknShine/target/classes/WalknShine/Register/Register.html*
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
<head></head><body>
User Registration
<br/>
<form wicket:id="registerForm">
<label for="name" wicket:id="nameLabel">Name</label> <input
type="text" id="name" wicket:id="name"/>
<input type="submit" value="Save" class="formbutton"
name="save" wicket:id="submitButton"/>
</form>
</body>
</html>, index = 4, current = '<form wicket:id="registerForm">' (line 0,
column 0)]
at
org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:526)
..
org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:781)
..
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-error-cannot-find-component-id-tp4481835p4481835.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: Wicket 1.5 error : cannot find component id
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
On Sun, Mar 18, 2012 at 2:41 PM, kshitiz <k....@gmail.com> wrote:
> Hi,
>
> Thank you for ur reply. I have added the form by writing
> *add(registerForm);* in the* constructor*. But I have just resolved by
> problem by replacing *wicket:id* in html page with *wickeT:id*
Do you say that "wicket:id" didn't work, but "wickeT:id" works ?!
The only way this to behave like this is that you have setup custom
Wicket namespace, e.g. <html xmlns:wickeT="..." or set
MarkupParser.WICKET="wickeT" in .java
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-error-cannot-find-component-id-tp4481835p4482073.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
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 error : cannot find component id
Posted by kshitiz <k....@gmail.com>.
Hi,
Thank you for ur reply. I have added the form by writing
*add(registerForm);* in the* constructor*. But I have just resolved by
problem by replacing *wicket:id* in html page with *wickeT:id*
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-error-cannot-find-component-id-tp4481835p4482073.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: Wicket 1.5 error : cannot find component id
Posted by Josh Kamau <jo...@gmail.com>.
Hi;
You did not add the form to the page by calling add(registerForm) on your
page class.
Regards
Josh.
On Sun, Mar 18, 2012 at 11:55 AM, kshitiz <k....@gmail.com> wrote:
> Hi,
>
> I am a new user in wicket world. I am facing a very common problem of which
> I have found many solutions but none of those helped me out...:(. My html
> page is:
>
> <body>
> <form wicket:id="registerForm">
> <div>
> <label for="name" wicket:id="nameLabel">Name</label> <input
> type="text" id="name" wicket:id="name"/>
>
> <input type="submit" value="Save" class="formbutton"
> name="save" wicket:id="submitButton"/>
> </div>
> </form>
> </body>
>
> and My java class is:
>
>
> public class Register extends WebPage{
>
> private String name;
>
> public Register()
> {
> Form<Register> registerForm = new
> Form<Register>("registerForm", new
> CompoundPropertyModel<Register>(this));
> add(registerForm);
> Label nameLabel = new Label("nameLabel", "Name"); // (2)
> registerForm.add(nameLabel);
> TextField<String> nameField = new TextField<String>("name"); //
> (3)
> registerForm.add(nameField);
> @SuppressWarnings("serial")
> Button submitButton = new Button("submitButton") {
> // (4)
> @Override
> public void onSubmit() {
> System.out.println("OnSubmit, name = " + name);
> }
> };
> registerForm.add(submitButton);
>
> }
>
> }
>
>
> I am getting the error:
>
> *Unable to find component with id 'registerForm' in [Page class =
> WalknShine.Register.Register, id = 3, render count = 1]
> Expected: '.registerForm'.
> Found with similar names: ''
> MarkupStream: [markup =
> file:/D:/WalknShine/target/classes/WalknShine/Register/Register.html*
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
> Strict//EN""
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
>
> xmlns:wicket="
> http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
>
> <head></head><body>
>
>
>
> User Registration
> <br/>
>
>
>
> <form wicket:id="registerForm">
>
> <label for="name" wicket:id="nameLabel">Name</label> <input
> type="text" id="name" wicket:id="name"/>
>
> <input type="submit" value="Save" class="formbutton"
> name="save" wicket:id="submitButton"/>
>
> </form>
>
> </body>
> </html>, index = 4, current = '<form wicket:id="registerForm">' (line 0,
> column 0)]
> at
>
> org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:526)
> ..
>
> org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
> at
>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:781)
> ..
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-error-cannot-find-component-id-tp4481835p4481835.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
>
>