I am using Wicket-1.4-SNAPSHOT libraries. I have a page with multiple forms.
These forms are within a Border as shown in the HTML below
<html>
<body>
<div wicket:id="border">
<form wicket:id="form1">
<input wicket:id="quantity1" /><br/>
<input type="submit" value="Quantity1" />
</form><br/>
<form wicket:id="form2">
<input wicket:id="quantity2" /><br/>
<input type="submit" value="Quantity2" />
</form><br/>
</div>
</body>
</html>
The Wicket code to this page is
public class CommonModelPage extends WebPage
{
private static final long serialVersionUID = 1L;
int quantity1;
int quantity2;
public CommonModelPage()
{
CommonBorder border = new CommonBorder("border");
add(border);
Form form1 = new Form("form1");
border.add(form1);
form1.add(new TextField("quantity1", new PropertyModel(this,
"quantity1")));
Form form2 = new Form("form2");
border.add(form2);
form2.add(new TextField("quantity2", new PropertyModel(this,
"quantity2")));
}
public int getQuantity1()
{
return quantity1;
}
public void setQuantity1(int quantity1)
{
this.quantity1 = quantity1;
}
public int getQuantity2()
{
return quantity2;
}
public void setQuantity2(int quantity2)
{
this.quantity2 = quantity2;
}
}
CommonBorder is an empty border class with no Wicket components and simple
HTML texts. The problem was when I submitted form1 or form2 I get this
exception
WicketMessage: Can't convert null value to a primitive class: int for
setting it on [Page class = CommonModelPage, id = 10, version = 0]
I found 2 unlikely way to circumvent this exception: -
1. Do not use Border.
2. Change quantity1 and quantity2 type from int to Integer.
My question is why does this happen? Ain't form1 and form2 are independent?
Do I need to change anything to Border to make this work?
Thanks
/lim/
--
View this message in context:
http://www.nabble.com/Multiple-Forms-in-A-Border-tp22252817p22252817.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]