wicket

Is RenderStrategy.ONE_PASS_RENDER a reasonable way to get rid of page version parameters like ?1 in a Wicket application?

我的梦境 提交于 2019-12-05 01:18:35
问题 We've been using Wicket 1.3.7 for a few years now and are currently in the process of upgrading our project to wicket 6.x I did a lot of research regarding to the page version parameters (e.g. ?1 ) being append to every URL, and how to get rid of them. (Could not find detailed information on this in the official documentation, unfortunately.) While doing so I read a lot of statements (from Wicket developers and users like It is needed to keep track of the page version, otherwise it would not

Injecting dependencies using @Autowired into objects created with “new …”

妖精的绣舞 提交于 2019-12-05 01:13:18
问题 I have a problem with injecting a bean into a helper class. It works basically like this: I create an object in the page constructor that does some work, returns some data and I show these on the page. In this helper object, a service should be injected via @Autowired annotation. However, I always get a null pointer exception when I use it. I also tried @SpringBean but it didn't help. On the other hand, when I inject this service directly into the page with @SpringBean , it's accessible and

How to open ModalDialog on PageLoad

折月煮酒 提交于 2019-12-04 19:25:41
问题 How can I open a modal dialog on PageLoad() , in the constructor of the WebPage and without the AjaxRequestTarget , with Wicket? 回答1: I couldn't find a way to open it without an Ajax request, but it's perfectly possible to open it when the page is loaded, with a simple behavior: HomePage.java public class HomePage extends WebPage { public HomePage(PageParameters pageParameters) { super(pageParameters); ModalWindow modal = new ModalWindow("modal"); modal.add(new OpenWindowOnLoadBehavior());

how to create a repeating list of links inside a li tag using apache wicket?

隐身守侯 提交于 2019-12-04 15:12:42
In Apache Wicket I would like to create a repeating list of links from code. I am not sure what the template should be to get to an html result that looks like this: <li><a href="whatevenrlink1">link1</a></li> <li><a href="whatevenrlink2">link2</a></li> <li><a href="whatevenrlink3">link3</a></li> so after much testing this worked for me. HTML should look like: <ul> <ui wicket:id="LinkList"><a wicket:id="Link"><span wicket:id="Text"/></a></ui> </ul> and then the repeating view code will be: RepeatingView view = new RepeatingView("LinkList"); add(view); WebMarkupContainer list = new

How to get the AjaxRequestTarget inside Wicket's onBeforeRender() method of a component?

♀尐吖头ヾ 提交于 2019-12-04 13:04:02
问题 I have an Ajax event that triggers the redraw of various Wicket panels. Some panels have additional calculations of their own inside their onBeforeRender() method. If there is an error, I want to display it to the user. But I can't add the FeedbackPanel to the AjaxRequestTarget because I don't have access to it anymore inside the panel that is being redrawn. Is there a way to get the AjaxRequestTarget inside onBeforeRender() of a Wicket component? Is it even possible to add additional

Wicket calling a lengthy operation and updating through ajax

▼魔方 西西 提交于 2019-12-04 10:39:54
Based on this SO question , I've come to an understanding that Wicket queues subsequent AJAX requests. Now my page is ridden with several AJAX requests and I'd like to add one more that spawns a lengthy operation. public void populateItem(final Item item) { final MyObject object = (MyObject) item.getModelObject(); // ... a couple of fields Label statusLabel = new Label("status", new AbstractReadOnlyModel() { @Override public Object getObject() { return someService.doSomeLengthyOperation(); } }); statusLabel.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5))); item.add(statusLabel) }

Wicket Dependency Injection

岁酱吖の 提交于 2019-12-04 10:24:23
I've got a page with a form in Wicket where the form requires a collaborator to get its job done. The collaborator is injected (for which I'm using Guice) and looks something like: public class RegistrationPage extends WebPage { @Inject public RegistrationPage(RegistrationService service) { this.service = service; add(new RegistrationForm()); } private class RegistrationForm extends Form { public RegistrationForm() { // setup } protected void onSubmit() { service.doSomething(); } } } I don't like the idea that the RegistrationService is injected into the RegistrationPage when it's just the

Checking User Agent in Wicket

橙三吉。 提交于 2019-12-04 09:10:21
I am using wicket 1.5 and I am not able to see in the getClientInfo() method (WebRequest)RequestCycle.get().getRequest() I saw the other place this code WebClientInfo clientInfo = (WebClientInfo)WebRequestCycle.get().getClientInfo(); But I am not able to see any WebRequestCycle in Wicket 1.5. Any ideas how to check the user agent in Wicket 1.5? Christoph Leiter The easiest way is to use WebSession.get().getClientInfo().getUserAgent(); On newer Wicket Versions (6 or newer), you should use: WebClientInfo clientInfo = new WebClientInfo(getRequestCycle()); System.out.println("Client: " +

Wicket redirect: how to pass on parameters and keeps URLs “pretty”?

血红的双手。 提交于 2019-12-04 08:54:14
Consider a Wicket WebPage that redirects to another page (based on some logic omitted from here): public class SomePage extends WebPage { public SomePage(PageParameters parameters) { setResponsePage(AnotherPage.class); setRedirect(true); } } I need to pass on the PageParameters to that other page, and this seems to be the way to do that: setResponsePage(new AnotherPage(parameters)); However, when creating a new Page object like this, I end up at an URL such as /?wicket:interface=:1:::: instead of the clean /another . AnotherPage is defined as: @MountPath(path = "another") public class

Spring roo Vs (Wicket and Spring)

强颜欢笑 提交于 2019-12-04 08:06:32
问题 Spring roo is new framework and I found it very interesting. I have been working on web application for last 3-4 years and Always found JSPs are hard to maintain across teams if everyone is not disciplined enough about separation of markup and serverside logic. I have used JackBe/BackBase in last projects and I enjoyed xml templates working as views. This was much better than JSPs. But I couldnt automate webtests through selenium for backbase. I would be surely using Spring MVC (-view),