0
我試圖把數據&顯示,通過使用組件標籤
數據,但這些數據並沒有看到在頁面
所有標籤都在錶行&行increses在這裏,但排犯規獲得標籤數據來源列表中,但不會看到到頁面
package com.cerebrum.pages;
import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.PropertyModel;
import com.cerebrum.common.Home;
import com.cerebrum.hibernate.AddForumSubCategoryEntity;
import com.cerebrum.hibernate.ForumHome;
import com.cerebrum.pojo.ForumModel;
public class Forum extends Home
{
ForumHome forumHome=new ForumHome();
ForumModel forumModel=new ForumModel();
List<ForumModel> listForum=new ArrayList<ForumModel>();
public Forum()
{
super();
add(new ForumForm());
}
class ForumForm extends Form
{
public ForumForm()
{
super("ForumForm");
setModel(new CompoundPropertyModel(forumModel));
List<AddForumSubCategoryEntity> list=forumHome.getAll();
for(AddForumSubCategoryEntity addForumSubCategoryEntity:list)
{
listForum.add(new
ForumModel(addForumSubCategoryEntity.getMain_key(),
addForumSubCategoryEntity.getDescription()));
}
ListView listView=new ListView("listForum",listForum)
{
@Override
protected void populateItem(ListItem item)
{
ForumModel model=(ForumModel)item.getDefaultModelObject();
Label lblMainCategory=new Label("lblMainCategory",new
PropertyModel(model, "lblMainCategory"));
item.add(lblMainCategory);
Label lblLastSubCategory=new
Label("lblLastSubCategory",new PropertyModel(model, "lblLastSubCategory"));
item.add(lblLastSubCategory);
Label lblTotalNoofPost=new Label("lblTotalNoofPost",new
PropertyModel(model, "lblTotalNoofPost"));
item.add(lblTotalNoofPost);
}
};
listView.setOutputMarkupId(true);
add(listView);
}
}
}
我失去了所有的車型。你想要歸檔什麼? – bert 2012-03-24 09:46:38