You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kumar ramanathan <ku...@gmail.com> on 2014/05/27 07:54:52 UTC
Errors in data view , req for help to fix the error in code
Hi Friends ,
Am trying to execute a wicket program to accomplish the below task,
a. a submit button is in place in a form
b. when I click that i have to show the ouput in data view of the same page
My codes are below and need your help to fix the erros and get the ouput
*Demoapplication.java*
package com.demo.application;
import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;
import com.demo.pages.*;
public class DemoApplication extends WebApplication {
@Override
public Class<? extends Page> getHomePage() {
// TODO Auto-generated method stub
return DemoHomePage.class;
}
}
DemoHomePage.html:
<html>
<body>
<form wicket:id="homePageForm">
<input type="submit" value="ok">
</form>
Id
Name
</body>
</html>
DemoHomePage.java
package com.demo.pages;
import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.*;
import org.apache.wicket.markup.html.list.*;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import com.sun.xml.internal.ws.org.objectweb.asm.Label;
public class DemoHomePage extends WebPage {
public DemoHomePage ()
{
Form form=new Form("homePageForm"){
public void submit(){
List<DemoBean> list = new ArrayList();
list.add(new DemoBean("1","ram"));
list.add(new DemoBean("2","sam"));
ListDataProvider<DemoBean> listDataProvider = new
ListDataProvider<DemoBean>(list);
DataView<DemoBean> dataView = new
DataView<DemoBean>("row",listDataProvider){
protected void populateItem(Item<DemoBean> item){
DemoBean bean=item.getModelObject();
RepeatingView repeatingView = new RepeatingView("dataRow");
repeatingView.add(new Label(repeatingView.newChildId().bean.getId()));
repeatingView.add(new Label(repeatingView.newChildId().bean.getName()));
item.add(repeatingView);
}
};
add(dataView);
}
};
}
}
Am getting the below error in the highlighted red area ListDataProvider
<DemoBean> and repeatingView.add.(.....)
Error:
Bound mismatch: The type DemoBean is not a valid substitute for the bounded
parameter <T extends Serializable> of the type ListDataProvider<T>
The method add(Component...) in the type MarkupContainer is not applicable
for the arguments (Label)
DemoBean.java
package com.demo.pages;
public class DemoBean {
public String id;
public String name;
public DemoBean(String id,String name)
{
this.id=id;this.name=name;
}
public String getId(){
return this.id;
}
public void setId(String id){
this.id=id;
}
public String getName(){
return this.name;
}
public void setName(String name){
this.name=name;
}
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025.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: Errors in data view , req for help to fix the error in code
Posted by Martin Grigorov <mg...@apache.org>.
Please create a quickstart app and share it with us (GitHub, BitBucket,..).
It will be easier to understand it by seeing the code.
See https://wicket.apache.org/start/quickstart.html
Martin Grigorov
Wicket Training and Consulting
On Thu, May 29, 2014 at 9:56 AM, kumar ramanathan <ku...@gmail.com>
wrote:
> Hi Friends,
> Please any help on how we can separate the data view code and populate the
> Provider value on submit the form .
>
> public class DemoHomePage extends WebPage {
>
> public ListDataProvider<DemoBean> listDataProvider;
> List<DemoBean> list = new ArrayList();
>
>
> public DemoHomePage ()
> {
>
> Form form=new Form("homePageForm"){
> public void submit(){
> list.add(new DemoBean("1","ram"));
> list.add(new DemoBean("2","sam"));
> listDataProvider = new ListDataProvider<DemoBean>(list);
> DataView<DemoBean> dataView = new
> DataView<DemoBean>("row",listDataProvider){
> private static final long
> serialVersionUID = 1L;
> protected void
> populateItem(Item<DemoBean> item){
> DemoBean
> bean=item.getModelObject();
>
> RepeatingView repeatingView = new RepeatingView("dataRow");
>
> repeatingView.add(new Label(repeatingView.newChildId(), bean.getId()));
>
> repeatingView.add(new Label(repeatingView.newChildId(), bean.getName()));
>
> item.add(repeatingView);
> }
> };
> add(dataView);
> }
> };
>
> //****************************************************************
>
>
> add(form);
> }
>
> * the error am getting is "unable to find wicket Id : row " *
>
> Thanks,
> Kumar Ramanathan
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666056.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: Errors in data view , req for help to fix the error in code
Posted by kumar ramanathan <ku...@gmail.com>.
Hi Friends,
Please any help on how we can separate the data view code and populate the
Provider value on submit the form .
public class DemoHomePage extends WebPage {
public ListDataProvider<DemoBean> listDataProvider;
List<DemoBean> list = new ArrayList();
public DemoHomePage ()
{
Form form=new Form("homePageForm"){
public void submit(){
list.add(new DemoBean("1","ram"));
list.add(new DemoBean("2","sam"));
listDataProvider = new ListDataProvider<DemoBean>(list);
DataView<DemoBean> dataView = new
DataView<DemoBean>("row",listDataProvider){
private static final long
serialVersionUID = 1L;
protected void
populateItem(Item<DemoBean> item){
DemoBean
bean=item.getModelObject();
RepeatingView repeatingView = new RepeatingView("dataRow");
repeatingView.add(new Label(repeatingView.newChildId(), bean.getId()));
repeatingView.add(new Label(repeatingView.newChildId(), bean.getName()));
item.add(repeatingView);
}
};
add(dataView);
}
};
//****************************************************************
add(form);
}
* the error am getting is "unable to find wicket Id : row " *
Thanks,
Kumar Ramanathan
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666056.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: Errors in data view , req for help to fix the error in code
Posted by kumar ramanathan <ku...@gmail.com>.
Martin,
I tried in the same way as before , again wicket id not referred error
comes.Please help me to correct my code below.
public class DemoHomePage extends WebPage {
public ListDataProvider<DemoBean> listDataProvider;
List<DemoBean> list = new ArrayList();
public DemoHomePage ()
{
Form form=new Form("homePageForm"){
public void submit(){
list.add(new DemoBean("1","ram"));
list.add(new DemoBean("2","sam"));
listDataProvider = new ListDataProvider<DemoBean>(list);
DataView<DemoBean> dataView = new
DataView<DemoBean>("row",listDataProvider){
private static final long serialVersionUID = 1L;
protected void populateItem(Item<DemoBean> item){
DemoBean bean=item.getModelObject();
RepeatingView repeatingView = new RepeatingView("dataRow");
repeatingView.add(new Label(repeatingView.newChildId(),
bean.getId()));
repeatingView.add(new Label(repeatingView.newChildId(),
bean.getName()));
item.add(repeatingView);
}
};
add(dataView);
}
};
//****************************************************************
add(form);
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666047.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: Errors in data view , req for help to fix the error in code
Posted by Martin Grigorov <mg...@apache.org>.
The data provider should be as before. Just start with empty List and put
the values into the List in onSubmit().
Read about static vs. dynamic models at
https://cwiki.apache.org/confluence/display/WICKET/Working+with+Wicket+models
You need dynamic data provider.
Martin Grigorov
Wicket Training and Consulting
On Tue, May 27, 2014 at 4:29 PM, kumar ramanathan
<ku...@gmail.com>wrote:
> Martin,I have tried to put the data view code out side the submit method
> ,it
> throwed the below error.java.lang.IllegalArgumentException: argument
> [dataProvider] cannot be null at
> org.apache.wicket.markup.repeater.data.DataViewBase.(DataViewBase.java:59)
> at org.apache.wicket.markup.repeater.data.DataView.(DataView.java:81)Can
> you
> please tell how to put the data view code in the form while constructing
> itself . If possible please give some example.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666041.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: Errors in data view , req for help to fix the error in code
Posted by kumar ramanathan <ku...@gmail.com>.
Martin,I have tried to put the data view code out side the submit method ,it
throwed the below error.java.lang.IllegalArgumentException: argument
[dataProvider] cannot be null at
org.apache.wicket.markup.repeater.data.DataViewBase.(DataViewBase.java:59)
at org.apache.wicket.markup.repeater.data.DataView.(DataView.java:81)Can you
please tell how to put the data view code in the form while constructing
itself . If possible please give some example.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666041.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: Errors in data view , req for help to fix the error in code
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
Please use some pastebin service with code highlighting next time. It is
hard to follow it in a mail client.
The problem is that you try to add a component (the DataView) on the fly
when the form is submitted.
You should add the dataview to the page or form when they are constructed
and just populate its IDataProvider with data in onSubmit();
I.e. initially the DataView will render empty (invisible for the user) and
will show itself after submit because it will have entries to show.
Martin Grigorov
Wicket Training and Consulting
On Tue, May 27, 2014 at 3:51 PM, kumar ramanathan
<ku...@gmail.com>wrote:
> Apologize Martin.Please tell how to fix my problem. Code snap is below for
> your reference,kindly help on what needs to modified in that.
>
> public DemoHomePage ()
> {
> Form form=new Form("homePageForm"){
> public void submit(){
> List<DemoBean> list = new ArrayList();
> list.add(new DemoBean("1","ram"));
> list.add(new DemoBean("2","sam"));
>
> ListDataProvider<DemoBean> listDataProvider = new
> ListDataProvider<DemoBean>(list);
>
> DataView<DemoBean> dataView = new
> DataView<DemoBean>("row",listDataProvider){
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
> protected void populateItem(Item<DemoBean> item){
> DemoBean bean=item.getModelObject();
> RepeatingView repeatingView = new
> RepeatingView("dataRow");
> repeatingView.add(new
> Label(repeatingView.newChildId(), bean.getId()));
> repeatingView.add(new
> Label(repeatingView.newChildId(),
> bean.getName()));
> item.add(repeatingView);
> }
> };
>
> add(dataView);
> }
> };
>
> add(form);
> }
>
> Html page:
>
> <html>
> <body>
> <form wicket:id="homePageForm">
> <input type="submit" value="ok">
> </form>
>
>
> Id
> Name
>
>
>
>
>
> </body>
> </html>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666039.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: Errors in data view , req for help to fix the error in code
Posted by kumar ramanathan <ku...@gmail.com>.
Apologize Martin.Please tell how to fix my problem. Code snap is below for
your reference,kindly help on what needs to modified in that.
public DemoHomePage ()
{
Form form=new Form("homePageForm"){
public void submit(){
List<DemoBean> list = new ArrayList();
list.add(new DemoBean("1","ram"));
list.add(new DemoBean("2","sam"));
ListDataProvider<DemoBean> listDataProvider = new
ListDataProvider<DemoBean>(list);
DataView<DemoBean> dataView = new
DataView<DemoBean>("row",listDataProvider){
/**
*
*/
private static final long serialVersionUID = 1L;
protected void populateItem(Item<DemoBean> item){
DemoBean bean=item.getModelObject();
RepeatingView repeatingView = new RepeatingView("dataRow");
repeatingView.add(new Label(repeatingView.newChildId(), bean.getId()));
repeatingView.add(new Label(repeatingView.newChildId(),
bean.getName()));
item.add(repeatingView);
}
};
add(dataView);
}
};
add(form);
}
Html page:
<html>
<body>
<form wicket:id="homePageForm">
<input type="submit" value="ok">
</form>
Id
Name
</body>
</html>
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666039.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: Errors in data view , req for help to fix the error in code
Posted by Martin Grigorov <mg...@apache.org>.
Hi Kumar,
The real problem is that you give us wrong information.
The error message says that you HAVE a component with wicket:id="row" in
your markup but it seems you've saved this from us!
The real problem is that you add the DataView (with id "row") to the page,
while it has to be added to the Form.
Martin Grigorov
Wicket Training and Consulting
On Tue, May 27, 2014 at 3:25 PM, kumar ramanathan
<ku...@gmail.com>wrote:
> Yes Martin,I Understand the problem is the row (wicket:id) is not properly
> referred in the java.
>
> but I have referred inside the submit method in dataview component . The
> data view scope is not accessible. It throwed the error.
>
> While using inside submit method , how we could make the scope accessible
> and resolve this problem.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666037.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: Errors in data view , req for help to fix the error in code
Posted by kumar ramanathan <ku...@gmail.com>.
Yes Martin,I Understand the problem is the row (wicket:id) is not properly
referred in the java.
but I have referred inside the submit method in dataview component . The
data view scope is not accessible. It throwed the error.
While using inside submit method , how we could make the scope accessible
and resolve this problem.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666037.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: Errors in data view , req for help to fix the error in code
Posted by Martin Grigorov <mg...@apache.org>.
Hi Kumar,
On Tue, May 27, 2014 at 3:08 PM, kumar ramanathan
<ku...@gmail.com>wrote:
> Thanks Martin.I did not import the label . Now that issue resolved.
>
> Now am facing issue in the run time.
>
> DemoHomePage.java
>
> package com.demo.pages;
>
> import java.util.ArrayList;
> import java.util.List;
>
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.form.*;
> import org.apache.wicket.markup.html.list.*;
> import org.apache.wicket.markup.repeater.Item;
> import org.apache.wicket.markup.repeater.RepeatingView;
> import org.apache.wicket.markup.repeater.data.DataView;
> import org.apache.wicket.markup.repeater.data.ListDataProvider;
> import org.apache.wicket.markup.html.basic.Label;
>
>
>
>
>
> public class DemoHomePage extends WebPage {
> public DemoHomePage ()
> {
> Form form=new Form("homePageForm"){
> public void submit(){
> List<DemoBean> list = new ArrayList();
> list.add(new DemoBean("1","ram"));
> list.add(new DemoBean("2","sam"));
>
> ListDataProvider<DemoBean> listDataProvider = new
> ListDataProvider<DemoBean>(list);
>
> final DataView<DemoBean> dataView = new
> DataView<DemoBean>("row",listDataProvider){
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
> protected void populateItem(Item<DemoBean> item){
> DemoBean bean=item.getModelObject();
> RepeatingView repeatingView = new
> RepeatingView("dataRow");
> repeatingView.add(new
> Label(repeatingView.newChildId(), bean.getId()));
> repeatingView.add(new
> Label(repeatingView.newChildId(),
> bean.getName()));
> item.add(repeatingView);
> }
> };
> add(dataView);
>
> }
> };
> add(form);
> }
>
> }
>
>
> *Html:*
>
> <html>
> <body>
> <form wicket:id="homePageForm">
> <input type="submit" value="ok">
> </form>
>
>
> Id
> Name
>
>
>
>
>
> </body>
> </html>
>
> Run time error is below:
> WicketMessage: Unable to find component with id 'row' in [Page class =
> com.demo.pages.DemoHomePage, id = 4, version = 0]. This means that you
> declared wicket:id=row in your markup, but that you either did not add the
> component to your page at all, or that the hierarchy does not match.
>
Which part of the explanation above is not clear?
It tells you exactly what the problem is.
> [markup =
>
> file:/home/kumar/Documents/javaapplications/Eclipse_Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/demo/WEB-INF/classes/com/demo/pages/DemoHomePage.html
> <html>
> <head></head><body>
> <form wicket:id="homePageForm">
> <input type="submit" value="ok">
> </form>
>
>
> Id
> Name
>
>
>
>
>
> </body>
> </html>, index = 8, current = '
> ' (line 11, column 1)]
>
> Root cause:
>
> org.apache.wicket.markup.MarkupException: Unable to find component with id
> 'row' in [Page class = com.demo.pages.DemoHomePage, id = 4, version = 0].
> This means that you declared wicket:id=row 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:/home/kumar/Documents/javaapplications/Eclipse_Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/demo/WEB-INF/classes/com/demo/pages/DemoHomePage.html
> <html>
>
> I have used row in the submit method , but the wicket is not able to find
> since Dataview scope is not exist outside submit method. How could we
> resolve this problem, please help me.
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666033.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: Errors in data view , req for help to fix the error in code
Posted by kumar ramanathan <ku...@gmail.com>.
Thanks Martin.I did not import the label . Now that issue resolved.
Now am facing issue in the run time.
DemoHomePage.java
package com.demo.pages;
import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.*;
import org.apache.wicket.markup.html.list.*;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.apache.wicket.markup.html.basic.Label;
public class DemoHomePage extends WebPage {
public DemoHomePage ()
{
Form form=new Form("homePageForm"){
public void submit(){
List<DemoBean> list = new ArrayList();
list.add(new DemoBean("1","ram"));
list.add(new DemoBean("2","sam"));
ListDataProvider<DemoBean> listDataProvider = new
ListDataProvider<DemoBean>(list);
final DataView<DemoBean> dataView = new
DataView<DemoBean>("row",listDataProvider){
/**
*
*/
private static final long serialVersionUID = 1L;
protected void populateItem(Item<DemoBean> item){
DemoBean bean=item.getModelObject();
RepeatingView repeatingView = new RepeatingView("dataRow");
repeatingView.add(new Label(repeatingView.newChildId(), bean.getId()));
repeatingView.add(new Label(repeatingView.newChildId(),
bean.getName()));
item.add(repeatingView);
}
};
add(dataView);
}
};
add(form);
}
}
*Html:*
<html>
<body>
<form wicket:id="homePageForm">
<input type="submit" value="ok">
</form>
Id
Name
</body>
</html>
Run time error is below:
WicketMessage: Unable to find component with id 'row' in [Page class =
com.demo.pages.DemoHomePage, id = 4, version = 0]. This means that you
declared wicket:id=row 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:/home/kumar/Documents/javaapplications/Eclipse_Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/demo/WEB-INF/classes/com/demo/pages/DemoHomePage.html
<html>
<head></head><body>
<form wicket:id="homePageForm">
<input type="submit" value="ok">
</form>
Id
Name
</body>
</html>, index = 8, current = '
' (line 11, column 1)]
Root cause:
org.apache.wicket.markup.MarkupException: Unable to find component with id
'row' in [Page class = com.demo.pages.DemoHomePage, id = 4, version = 0].
This means that you declared wicket:id=row 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:/home/kumar/Documents/javaapplications/Eclipse_Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/demo/WEB-INF/classes/com/demo/pages/DemoHomePage.html
<html>
I have used row in the submit method , but the wicket is not able to find
since Dataview scope is not exist outside submit method. How could we
resolve this problem, please help me.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666033.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: Errors in data view , req for help to fix the error in code
Posted by Martin Grigorov <mg...@apache.org>.
Are you sure you have imported Wicket's Label component in this class ?
Martin Grigorov
Wicket Training and Consulting
On Tue, May 27, 2014 at 9:38 AM, kumar ramanathan
<ku...@gmail.com>wrote:
> a. The method add(Component...) in the type MarkupContainer is not
> applicable
> for the arguments (Label)
> b. The constructor Label(String, String) is undefined
>
> these are the two errors.please help.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666030.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: Errors in data view , req for help to fix the error in code
Posted by kumar ramanathan <ku...@gmail.com>.
a. The method add(Component...) in the type MarkupContainer is not applicable
for the arguments (Label)
b. The constructor Label(String, String) is undefined
these are the two errors.please help.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666030.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: Errors in data view , req for help to fix the error in code
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
What is the error ?
Martin Grigorov
Wicket Training and Consulting
On Tue, May 27, 2014 at 9:16 AM, kumar ramanathan
<ku...@gmail.com>wrote:
> Thanks,
> The serializable error resolved once it has been implemented. I have the
> error in the below add component still(which is in bold font).Please help
> me
> on this.
>
> repeatingView*.add(n*ew Label(repeatingView.newChildId(), bean.getId()));
> repeatingView.add(new
> Label(repeatingView.newChildId(),*
> bean.getName()));*
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666027.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: Errors in data view , req for help to fix the error in code
Posted by Francois Meillet <fr...@gmail.com>.
You should read these very good documentation
http://wicket.apache.org/guide/guide/single.pdf
http://www.wicket-library.com/wicket-examples-6.0.x/repeater/
François Meillet
Formation Wicket - Développement Wicket
Le 27 mai 2014 à 09:16, kumar ramanathan <ku...@gmail.com> a écrit :
> Thanks,
> The serializable error resolved once it has been implemented. I have the
> error in the below add component still(which is in bold font).Please help me
> on this.
>
> repeatingView*.add(n*ew Label(repeatingView.newChildId(), bean.getId()));
> repeatingView.add(new Label(repeatingView.newChildId(),*
> bean.getName()));*
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666027.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: Errors in data view , req for help to fix the error in code
Posted by kumar ramanathan <ku...@gmail.com>.
Thanks,
The serializable error resolved once it has been implemented. I have the
error in the below add component still(which is in bold font).Please help me
on this.
repeatingView*.add(n*ew Label(repeatingView.newChildId(), bean.getId()));
repeatingView.add(new Label(repeatingView.newChildId(),*
bean.getName()));*
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025p4666027.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: Errors in data view , req for help to fix the error in code
Posted by Francois Meillet <fr...@gmail.com>.
The DemoBean needs to implement the Serializable interface.
François Meillet
Formation Wicket - Développement Wicket
Le 27 mai 2014 à 07:54, kumar ramanathan <ku...@gmail.com> a écrit :
> Hi Friends ,
>
> Am trying to execute a wicket program to accomplish the below task,
>
> a. a submit button is in place in a form
> b. when I click that i have to show the ouput in data view of the same page
>
> My codes are below and need your help to fix the erros and get the ouput
>
>
> *Demoapplication.java*
>
> package com.demo.application;
>
> import org.apache.wicket.Page;
> import org.apache.wicket.protocol.http.WebApplication;
> import com.demo.pages.*;
>
> public class DemoApplication extends WebApplication {
>
> @Override
> public Class<? extends Page> getHomePage() {
> // TODO Auto-generated method stub
> return DemoHomePage.class;
> }
>
> }
>
> DemoHomePage.html:
> <html>
> <body>
> <form wicket:id="homePageForm">
> <input type="submit" value="ok">
> </form>
>
>
> Id
> Name
>
>
>
>
>
> </body>
> </html>
>
> DemoHomePage.java
> package com.demo.pages;
>
> import java.util.ArrayList;
> import java.util.List;
>
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.form.*;
> import org.apache.wicket.markup.html.list.*;
> import org.apache.wicket.markup.repeater.Item;
> import org.apache.wicket.markup.repeater.RepeatingView;
> import org.apache.wicket.markup.repeater.data.DataView;
> import org.apache.wicket.markup.repeater.data.ListDataProvider;
>
> import com.sun.xml.internal.ws.org.objectweb.asm.Label;
>
>
>
> public class DemoHomePage extends WebPage {
> public DemoHomePage ()
> {
> Form form=new Form("homePageForm"){
> public void submit(){
> List<DemoBean> list = new ArrayList();
> list.add(new DemoBean("1","ram"));
> list.add(new DemoBean("2","sam"));
>
> ListDataProvider<DemoBean> listDataProvider = new
> ListDataProvider<DemoBean>(list);
>
> DataView<DemoBean> dataView = new
> DataView<DemoBean>("row",listDataProvider){
> protected void populateItem(Item<DemoBean> item){
> DemoBean bean=item.getModelObject();
> RepeatingView repeatingView = new RepeatingView("dataRow");
> repeatingView.add(new Label(repeatingView.newChildId().bean.getId()));
> repeatingView.add(new Label(repeatingView.newChildId().bean.getName()));
> item.add(repeatingView);
> }
> };
>
> add(dataView);
> }
> };
>
> }
>
> }
>
> Am getting the below error in the highlighted red area ListDataProvider
> <DemoBean> and repeatingView.add.(.....)
>
> Error:
> Bound mismatch: The type DemoBean is not a valid substitute for the bounded
> parameter <T extends Serializable> of the type ListDataProvider<T>
> The method add(Component...) in the type MarkupContainer is not applicable
> for the arguments (Label)
>
> DemoBean.java
>
> package com.demo.pages;
>
> public class DemoBean {
> public String id;
> public String name;
>
> public DemoBean(String id,String name)
> {
> this.id=id;this.name=name;
> }
>
> public String getId(){
> return this.id;
> }
>
> public void setId(String id){
> this.id=id;
> }
>
> public String getName(){
> return this.name;
> }
>
> public void setName(String name){
> this.name=name;
> }
>
>
> }
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Errors-in-data-view-req-for-help-to-fix-the-error-in-code-tp4666025.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
>