- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试添加具有指定排序属性的列时出现 NPE。关于我做错了什么有什么想法吗?
这是类:
@Entity
@Table(name="checklist_template")
public class CheckListTemplate extends DomainObject implements Comparable<CheckListTemplate>, Serializable {
private static final long serialVersionUID = 2959377496669050427L;
@Id
@GeneratedValue
private Long id;
@Column(nullable=false)
private String name;
public CheckListTemplate() {}
public CheckListTemplate(String name) {
this.name = name;
}
//some other attributes, getters, setters etc
}
这是代码:
public class CheckListTemplateDataPanel extends Panel {
@SpringBean
public ChecklistTemplateService checklistTemplateService;
DataTable<CheckListTemplate> table;
NavigationToolbar navigationToolbar;
ChecklistTemplateProvider checklistTemplateProvider;
public CheckListTemplateDataPanel(String id) {
super(id);
IColumn[] columns = new IColumn[1];
columns[0] = new PropertyColumn<CheckListTemplate>(Model.of("Name"), "name", "name"); //this is what generates the exception. if i ignore the third argument, the code works but i get no link to click for sorting
table = new DataTable<CheckListTemplate>("datatable", columns, checklistTemplateProvider = new ChecklistTemplateProvider(), 10);
table.setOutputMarkupId(true);
table.addBottomToolbar(navigationToolbar = new NavigationToolbar(table));
table.addTopToolbar(new HeadersToolbar(table, null));
add(table);
}
private class ChecklistTemplateProvider extends SortableDataProvider<CheckListTemplate> {
public ChecklistTemplateProvider() {
setSort("name", true);
}
@Override
public Iterator<? extends CheckListTemplate> iterator(int first, int count) {
return checklistTemplateService.findAll(new PageRequest(table.getCurrentPage(), count)).iterator();
}
@Override
public int size() {
return safeLongToInt(checklistTemplateService.count());
}
@Override
public IModel<CheckListTemplate> model(CheckListTemplate object) {
return Model.of(object);
}
public void setFilterString(String filterString){
this.filterString = filterString;
}
}
public static int safeLongToInt(long l) {
if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) {
throw new IllegalArgumentException
(l + " cannot be cast to int without changing its value.");
}
return (int) l;
}
}
这是异常(exception)情况:
2012 May 03 13:58:58,480[ERROR] - RequestCycle - Exception in rendering component: [MarkupContainer [Component id = header]]
org.apache.wicket.WicketRuntimeException: Exception in rendering component: [MarkupContainer [Component id = header]]
at org.apache.wicket.Component.renderComponent(Component.java:2729)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1441)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1528)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.markup.repeater.AbstractRepeater.renderChild(AbstractRepeater.java:122)
at org.apache.wicket.markup.repeater.AbstractRepeater.onRender(AbstractRepeater.java:103)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1441)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:697)
at org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java:114)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable$ToolbarContainer.onRender(DataTable.java:429)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.markup.repeater.AbstractRepeater.renderChild(AbstractRepeater.java:122)
at org.apache.wicket.markup.repeater.AbstractRepeater.onRender(AbstractRepeater.java:103)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1441)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:697)
at org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java:114)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1441)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:697)
at org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java:114)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1441)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1528)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:229)
at org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:66)
at org.apache.wicket.markup.resolver.ComponentResolvers.resolve(ComponentResolvers.java:81)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1445)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1528)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:229)
at org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:73)
at org.apache.wicket.markup.resolver.ComponentResolvers.resolve(ComponentResolvers.java:81)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1445)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1528)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:229)
at org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:66)
at org.apache.wicket.markup.resolver.ComponentResolvers.resolve(ComponentResolvers.java:81)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1445)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1528)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:229)
at org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:73)
at org.apache.wicket.markup.resolver.ComponentResolvers.resolve(ComponentResolvers.java:81)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1445)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1528)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:229)
at org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:66)
at org.apache.wicket.markup.resolver.ComponentResolvers.resolve(ComponentResolvers.java:81)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1445)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1604)
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1528)
at org.apache.wicket.Component.renderComponent(Component.java:2690)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1539)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:229)
at org.apache.wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:73)
at org.apache.wicket.markup.resolver.ComponentResolvers.resolve(ComponentResolvers.java:81)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1445)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1555)
at org.apache.wicket.Page.onRender(Page.java:1594)
at org.apache.wicket.Component.render(Component.java:2521)
at org.apache.wicket.Page.renderPage(Page.java:932)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1258)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at org.apache.wicket.extensions.markup.html.repeater.data.sort.OrderByLink$CssModifier.onComponentTag(OrderByLink.java:208)
at org.apache.wicket.Component.renderComponentTag(Component.java:4270)
at org.apache.wicket.Component.renderComponent(Component.java:2681)
... 125 more
最佳答案
错误在这里:
table.addTopToolbar(new HeadersToolbar(table, null));
您必须在构造函数中提供 DataProvider 的实例,而不是 null
。
关于java - Wicket 数据表属性列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10425429/
过去,我为我的表单构建了如下标签: : 我还需要使用wicket:label吗?标签?我没有使用 wicket:label在 wicket 7 中,它似乎工作正常。我可能不理解使用 wicket:la
是否可以为 MarkupContainer 生成标记?动态地,即不为其存储 HTML 文件? 我考虑将标记作为纯字符串从数据库中读取,以提供类似 CMS 的功能。 最佳答案 有趣的问题,我不确定这是否
是否有适用于 Wicket 1.5 的有效、支持和维护的脚手架解决方案?我知道 Wicketopia 位于两个不同地点 sourceforge和 github但这仍然针对 wicket 1.4,带来了
我想了解一些关于 wicket 支持泛型模型的信息。我了解了模型、 Prop 模型和 Prop 复合模型。 但是 Model 类呢?如果我这样做会发生什么: Label label = new Lab
如何在 Wicket 中实现多选下拉。我能够使用 bootstrap 创建多选下拉 View ,但我无法获得如何将所选选项与下拉组件的 IModel 相关联? Wicket 有没有可能?我不想使用 L
我正在使用 wicket 1.4.9 并实现了 spring + wicket auth-role 并根据页面上的角色使用@AuthorizeInstantiation。我有多个自定义角色。 我已经按
如何在 Wicket 1.5 中执行以下操作? page.getRequestCycle().setRequestTarget(new RedirectRequestTarget("http://ww
我想用密码保护 Wicket 中的网页,以便用户只有在他/她登录后才能访问它。 我还希望该页面显示登录页面,然后在登录用户试图访问的原始页面后。 这是如何用 wicket 完成的?我已经创建了一个登录
我使用的是 wicket 1.5,但在 getClientInfo() 方法中看不到 (WebRequest)RequestCycle.get().getRequest() 我在另一个地方看到了这段代
我刚刚尝试了 Apache Wicket“Hello, world”应用程序,我注意到在呈现的 HTML 输出中,Wicket 暴露了它的内部属性。 这是呈现的 HTML 在浏览器的“查看源代码”中的
我找不到像 wicket:include 之类的 wicket 标签?谁能建议我什么?我想在 html 文件中包含/注入(inject)原始源代码?如果没有这样的实用程序,有什么建议来开发它吗? 更新
在页面中查找特定(已知 wicket id)Wicket 组件的方法是什么? 最佳答案 您的选择是: get()搜索一个组件的方法 特定路径上的组件。 安 iterator()在拥有他所有 child
我正在为 wicket 页面编写测试。我的页面上有三个下拉菜单。根据从下拉列表中选择的值,面板会被渲染(面板包含一个数据表)。 如何更改 wicket 测试中下拉菜单的值,以便我可以针对所选值的不同组
在我的 wicket 应用程序中,有一些页面供用户使用,具体取决于他们的角色和不同的标准。在我的数据库中,我存储了用作该用户背景的图像路径。每个用户都有一个独特的页面。我知道我可以添加读取图像,如果我
如何在 Wicket 中定义我自己的反馈消息? 例如:如果我提供了一个错误的用户名,我想得到一个错误信息,如“用户名不正确,请尝试再次登录”。而不是使用默认的错误消息。 一个例子会是什么样的? 最佳答
假设我想要 3 个不同的 *.html 用于 WebPage。 F.e. page_small.html、page_tablet.html、page_desktop.html。我如何解析 screen
我无法确定 Wicket 应用程序中 RuntimeException 的原因。我设置了许多断点,但是当我提交表单时,只有在加载表单时,没有一个断点被触发。这是堆栈: WicketMessage: N
我刚刚编写了我的第一个 Wicket 组件 :) 它包含一个 ListView 和一些 Radio 输入字段。现在我想对所选值是否进入模型进行单元测试。 由于 WicketTester.newForm
我的类属性有两个 CSS 类值。 HTML 开头是这样的: 我想动态地把它改成这样: 目前我正在这样做: component.add(new SimpleAttributeModifier("cl
我有一个使用 PropertyModel 的文本字段,如下所示: TextField ageField = new TextField("age", new
我是一名优秀的程序员,十分优秀!