Forgive me for putting this on the mailing list; I don't have access to the IRC at work. But as a beginner, it seems that everything I do is a struggle to get it to work, even if I'm just paraphrasing from the examples.
In this case, I'm trying to create a RadioGroup. The error I'm getting is:
Root cause:
wicket.markup.MarkupException: Unable to find component with id 'radios' in [ MarkupContainer [Component id = form, page = mem.components.RadioGroupPlayPage, path = 1:form.Form, isVisible = true, isVersioned = true]]. This means that you declared wicket:id=radios in your markup, but that you either did not add the component to your page at all, or that the hierarchy does not match.
[markup = file:/C:/Tomcat/jakarta-tomcat-5.5.9 /webapps/SpssWebModule/WEB-INF/classes/mem/components/RadioGroupPlayPage.html, index = 8, current = '<tr wicket:id="radios">' (line 7, column 13)]
But I did declare a Wicket component with id "radios" and the hierarchy _does _ match. HTML clearly shows a "radio" in "radios" in "group" in "form"
<html xmlns="http://www.w3.org/1999/xhtml " xmlns:wicket="http://wicket.sourceforge.net/" xml:lang ="en" lang="en">
<head></head>
<body>
<form wicket:id="form" id="form">
<span wicket.id="group">
<table>
<tr wicket:id="radios">
<td>
<input type="radio" wicket :id="radio"/>
</td>
<td>
<span wicket:id="option">option name</span>
</td>
</tr>
</table>
</span>
<input type="submit" value="Submit"/>
</form>
<div wicket:id="result">selected choice goes here</div>
</body>
</html>
The framework admits as much – "radio" in "radios" in "group" in "form"
Page
[Page class = mem.components.RadioGroupPlayPage, id = 15]:
#
Path
Size
Type
Model Object
1
_body
403 bytes
wicket.markup.html.internal.HtmlBodyContainer
2
form
3.4K
wicket.markup.html.form.Form
3
form:group
3.4K
wicket.markup.html.form.RadioGroup
A
4
form:group:radios
3.4K
wicket.markup.html.list.ListView
[[Ljava.lang.String;@c52200, [Ljava.lang.String;@d72200, [Ljava.lang.String;@164b9b6, [Ljava.lang.String;@166340c]
5
form:group:radios:0
3.4K
wicket.markup.html.list.ListItem
[Ljava.lang.String;@c52200
6
form:group:radios:0:option
3.4K
wicket.markup.html.basic.Label
Ay
7
form:group:radios:0:radio
3.4K
wicket.markup.html.form.Radio
A
8
form:group:radios:1
3.4K
wicket.markup.html.list.ListItem
[Ljava.lang.String;@d72200
9
form:group:radios:1:option
3.4K
wicket.markup.html.basic.Label
Bee
10
form:group:radios:1:radio
3.4K
wicket.markup.html.form.Radio
B
11
form:group:radios:2
3.4K
wicket.markup.html.list.ListItem
[Ljava.lang.String;@164b9b6
12
form:group:radios:2:option
3.4K
wicket.markup.html.basic.Label
See
13
form:group:radios:2:radio
3.4K
wicket.markup.html.form.Radio
C
14
form:group:radios:3
3.4K
wicket.markup.html.list.ListItem
[Ljava.lang.String;@166340c
15
form:group:radios:3:option
3.4K
wicket.markup.html.basic.Label
Dee
16
form:group:radios:3:radio
3.4K
wicket.markup.html.form.Radio
D
17
result
3.4K
wicket.markup.html.basic.Label
A
Here is my actual page:
package mem.components;
import wicket.markup.html.WebPage;
import wicket.markup.html.basic.Label;
import wicket.model.IModel;
import wicket.markup.html.panel.Panel;
import wicket.markup.html.form.Radio;
import wicket.markup.html.form.RadioGroup;
import wicket.markup.html.list.ListItem;
import wicket.markup.html.list.ListView;
import wicket.model.PropertyModel;
import java.util.List;
import wicket.markup.html.form.Form;
import java.util.Arrays;
public class RadioGroupPlayPage extends WebPage {
public String selectedProperty = "A";
public RadioGroupPlayPage() {
Form form = new Form("form");
add(form);
PropertyModel groupModel = new PropertyModel (this, "selectedProperty");
String[][] optionArray = { {"A", "Ay"}, {"B", "Bee"}, {"C", "See"}, {"D", "Dee"} };
final RadioGroup group = new RadioGroup("group", groupModel);
form.add(group);
List optionList = Arrays.asList( optionArray );
ListView radios = new ListView("radios", optionList) {
protected void populateItem(ListItem listItem) {
listItem.add( new Radio("radio",
new PropertyModel( listItem.getModel (), "0") ) );
listItem.add( new Label("option", new PropertyModel( listItem.getModel(), "1" )));
}
};
group.add(radios);
add( new Label("result", groupModel) );
}
}
Again, Radio("radio") is added to ListView("radios") is added to RadioGroup ("group") is added to Form("form")
So why is it complaining?
Wicket is right:
replace the "." with ":"
Juergen
On 2/21/06, Frank Silbermann <[EMAIL PROTECTED]> wrote: