[JAVA] Tokoro I rewrote in the migration from Wicket 7 to 8

Synopsis so far

I tried migrating a small application made with Wicket7 to Wicket8. A play that erases errors and warnings and enumerates the rewritten contents up to the point where it works for the time being. I'm not feeling any better now. Also, Lambda is not handled.

This is a nanika like a memorandum. If you want to migrate properly, you should definitely see Migration Guide for Home.

Second argument of AjaxButton.onSubmit ()

The Form that was passed as an argument until now is gone. I didn't refer to it in my code, so just delete the argument. If you want, you can get it with ʻAjaxButton.getForm ()`.

Event name specified in AjaxEventBehavior (and its subclasses)

For example, ʻAjaxFormComponentUpdatingBehavior`.


//until now"onchange"It worked even if I specified it ...
hoge.add(new AjaxFormComponentUpdatingBehavior("change") {
    protected void onUpdate(AjaxRequestTarget target) {
        //Something processing

There are no exceptions even if ʻon is attached, but JavaScript does not work. From the time of Wicket 6.x, it seems that a warning log appeared in the log saying "Don't write on. I'll forgive you now, but forgive me from 8." I didn't notice. I don't care, but I think the class name ʻAjaxFormComponentUpdatingBehavior is too long.

AbstractReadOnlyModel Deprecated

Don't use batten. If it is an IDE, the strikethrough will be drawn and the feeling of use will be doubled. It's easy to fix, just replace it with ʻIModel`.

I used it via a label like the one below, so I only changed it in one place. ʻAbstractReadOnlyModel` has a lot of characters, so I just didn't want to write it many times.


package yamane.wicket;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;

public abstract class ReadOnlyLabel<T> extends Label {
    public ReadOnlyLabel(String id) {
        //I rewrote this to IModel
        // setDefaultModel(new AbstractReadOnlyModel<T>() {
        setDefaultModel(new IModel<T>() {
            public T getObject() {
                return load();
    protected abstract T load();

Because Java8 is required and the default method of the interface can be used. Very refreshing.

AbstractRequestCycleListener Deprecated

This is almost the same as ʻAbstractReadOnlyModel. Replace ʻextends with ʻimplements and replace ʻIRequestCycleListener with the default method added. But this wasn't mentioned in the migration guide, right? I often use it for handling before writing out the error page, but I wonder if everyone is using it.

Component.onConfigure () method

Super.onConfigure () is now required when overriding. Until now, the implementation of Component.onConfigure () was empty, so I thought "I don't need to call it, the one-line description will be reduced", but from Wicket8, "No, exception, you will die". I will. eh? Did you mention that it is essential for JavaDoc from before? I'm sorry I didn't read it.

It's a method that is overridden frequently, so there are many changes. I just grep and copy. This was the biggest for me.

So far

It was a lot less change than I expected.

I personally think that the code for Wicket applications will be quite different for each programmer. Which is not the right mistake, but the individuality or habit. So, I'm sure there will be different rewrite locations for Wicket 7 applications made by different people. I haven't seen much code for Wicket applications made by anyone other than myself, so I'm not sure.

It ends abruptly after appealing the uselessness of this article.

Recommended Posts

Tokoro I rewrote in the migration from Wicket 7 to 8
What I did in the migration from Spring Boot 1.4 series to 2.0 series
What I did in the migration from Spring Boot 1.5 series to 2.0 series
What I did in the version upgrade from Ruby 2.5.2 to 2.7.1
[Android] I want to get the listener from the button in ListView
[Rails] I tried to raise the Rails version from 5.0 to 5.2
Migration from Eclipse to IntelliJ (on the way)
I tried to organize the session in Rails
I want to get the value in Ruby
I was addicted to the NoSuchMethodError in Cloud Endpoints
[Java] I want to calculate the difference from the date
I want to embed any TraceId in the log
I tried to implement the Euclidean algorithm in Java
Migration from Cobol to JAVA
I tried to make an application in 3 months from inexperienced
[Beginner] I want to modify the migration file-How to use rollback-
Understand the rough flow from request to response in SpringWebMVC
I want to set the conditions to be displayed in collection_check_boxes
[JDBC] I tried to access the SQLite3 database from Java.
I want to transition to the same screen in the saved state
I tried upgrading from CentOS 6.5 to CentOS 7 with the upgrade tool
I want to simplify the conditional if-else statement in Java
In Java, I want to trim multiple specified characters from only the beginning and end.
I want to recreate the contents of assets from scratch in the environment built with capistrano
I can't log in to MySQL from Django when using docker-compose
I tried to summarize the words that I often see in docker-compose.yml
protocol buffeer migration from 2.x to 3.x
Pass the i18n locale to JavaScript
I tried to illuminate the Christmas tree in a life game
I tried to sort the data in descending order, ascending order / Rails
I tried to explain the method
The story I wanted to unzip
I want to display the images under assets/images in the production environment
I want to remove the top margin in Grouped UITableView (swift)
[Java] I want to perform distinct with the key in the object
I tried to solve the paiza campaign problem "Challenge from Kaito 813"
What happened to the typical changes in Apache Wicket 8 after all?
The road from JavaScript to Java
I want to change the value of Attribute in Selenium of Ruby
I think it's okay to write joins etc. in the scope
[Ruby] I want to output only the odd-numbered characters in the character string
[Rails] I learned about migration files! (Adding a column to the table)
I want to write JSP in Emacs more easily than the default.
I summarized the points to note when using resources and resources in combination
Follow from the root node to the lower node with JavaFX ~ I know the directions ~
Confirmation and refactoring of the flow from request to controller in [httpclient]
I tried to solve the tribonacci sequence problem in Ruby, with recursion.
I called the COTOHA API parser 100 times in Java to measure performance.
I want to get the IP address when connecting to Wi-Fi in Java
How to get the setting value (property value) from the database in Spring Framework
I thought about the best way to create a ValueObject in Ruby
I tried to make full use of the CPU core in Ruby
I want to display an error message when registering in the database
I was addicted to unit testing with the buffer operator in RxJava
[Ruby] I tried to summarize the methods that frequently appear in paiza
[Ruby] I tried to summarize the methods that frequently appear in paiza ②
I translated the grammar of R and Java [Updated from time to time]
I had to lower the PHP version in Docker + Composer + Laravel environment
I want to find out what character the character string appears from the left
What is CHECKSTYLE: OFF found in the Java source? Checkstyle to know from
Shorten the UUID to base64 in Swift.