Would simple String concatenation not work here for you?

-Mihir.


On Tue, Jun 10, 2014 at 12:02 PM, kumar ramanathan <kumarramana...@gmail.com
> wrote:

> Hi Friends ,
> I have successfully generated the view using repeaters using the following
> code.
>
> HTML:
> <body>
>
>
> Name    Id
>
>
>
>
>
> </body>
>
> HelloWorld.java
> public HelloWorld(){
>         List<Persons> list = new  ArrayList<Persons>();
>         list.add(new Persons("sam","one"));
>         list.add(new Persons("ram","two"));
>         ListDataProvider<Persons> listDataProvider = new
> ListDataProvider<Persons>(list);
>         DataView<Persons> dataView = new DataView<Persons>("rows",
> listDataProvider) {
>             @Override protected void populateItem(Item<Persons> item)
>                 {
>                   Persons person = item.getModelObject();
>                   RepeatingView repeatingView = new
> RepeatingView("dataRow");
>                   repeatingView.add(new Label(repeatingView.newChildId(),
> person.getName()));
>                   repeatingView.add(new Label(
> repeatingView.newChildId(),person.getId()));
>                   item.add(repeatingView);
>                  }
>         };
>         add(dataView);
>      }
> Ouput I got :
>
> Name Id
> sam one(not link)
> ram  two(not link)
>
> Now I have tried to display the above ouput as below with link
>
> Name Id
> sam one(link)
> ram  two(link)
>
>
> For this ouput i have altered the code in helloword.java as below
>
>
> DataView<Persons> dataView = new DataView<Persons>("rows",
> listDataProvider){
>  protected void populateItem(Item<Persons> item){
>   Persons person = item.getModelObject();
>   RepeatingView repeatingView = new RepeatingView("dataRow");
>   repeatingView.add(new Label(repeatingView.newChildId(),
> person.getName()));
>   repeatingView.add(new Link(person.getId()){
>          public void onClick(){
>          setResponsePage(Output.class);
>          }
>           });
>   item.add(repeatingView);
>   }
> }; add(dataView);}}
>
> Output I got for the above code change is
>
> Name Id
> sam
> ram
>
> No Id value is displayed.
>
> I need your help on making code changes to display the id as link. Kindly
> help me what are the things i need to update.
> Thanks,
> Kumar
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Link-in-repeaters-tp4666176.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to