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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to