0

我正在使用 wicket 6.9 我有一个表,其中链接列是这样创建的:

               @Override
                public void onClick() {
                    PageParameters pageParameters = new PageParameters();
                    IEntity iEntity = (IEntity) getDefaultModelObject();
                    pageParameters.set(HomePage.NAVIGATE_TO, navigateTo);
                    String routingPropertyToPass = "";
                    String idToPass = String.valueOf(BeanUtils.getProperty(iEntity, idPropertyToPass));
                    log.info(routingProperty);
                    if (!ColumnType.LINKABLE_WITH_FILTER.equals(columnDisplay.getColumnType()))
                        routingPropertyToPass = String.valueOf(BeanUtils.getProperty(iEntity, routingProperty));
                    if (filterBy != null) {
                        log.info("passing to the next page idPropertyToPass = {} and idToPass {}", iconCssOrNextPageReflectionProperty,
                                idToPass);
                        pageParameters.add("filterBy", iconCssOrNextPageReflectionProperty + "," + idToPass);
                    } else {
                        pageParameters.set(HomePage.ENTITY_ID, idToPass);
                        pageParameters.set(HomePage.ROUTING_PROPERTY, routingPropertyToPass);
                    }
                    pageParameters.set(HomePage.CLASS_NAME, clazz.getSimpleName());

                    HomePage homePage = new HomePage(pageParameters);
                    setResponsePage(homePage);

                }

当在另一个选项卡中打开链接时,一切正常,第二个和第三个也是如此。但是当我在 1-3 提交并返回网格并从那里再次单击另一个链接时,页面已过期

为什么?

4

1 回答 1

1

Instead of doing all this stuff in the onClick() method of the link, compute the pageParameters object one block in, and use a BookmarkablePageLink like this:

add(new BookmarkablePageLink("link", HomePage.class, pageParameters);

The reason why you are seeing page expired messages is because the Link you are using will render non bookmarkable urls, relative to the user's page version and most probably opening newer page versions on other tabs caused the old version on which the link was valid to get discarded. You can tweak how much page versions wicket stores on the Application object, but in case you have all this nice pageparameter based stuff going on you are better off fixing your links to render bookmarkable (stateless) urls.

于 2013-09-04T14:36:46.537 回答