Showing posts with label Wicket. Show all posts
Showing posts with label Wicket. Show all posts

Apache Wicket Hello world example


1. Create a Apache a wicket project


Clik here to get help for create Apache Wicket Project

2. Create Application classes

Apache wicket is working via conventions and there is no configuration needed, but we have to put the class file and html file in right package.

Page java file

This file needs to extend webpage and add the components
package com.mycompany;

import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.WebPage;

public class HomePage extends WebPage {
    private static final long serialVersionUID = 1L;

    public HomePage(final PageParameters parameters) {
        super(parameters);
        add(new Label("message", "Hello world by Java release...."));
    }
}
  

Web application file

This file needs to extend Web application and override getHomePage method

In getHomePage method we have to add our page java file class name
package com.mycompany;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.protocol.http.WebApplication;

/**
 * Application object for your web application. If you want to run this
 * application without deploying, run the Start class.
 *
 * @see com.mycompany.Start#main(String[])
 */

public class WicketApplication extends WebApplication {
    /**
     * @see org.apache.wicket.Application#getHomePage()
     */

    @Override
    public Class<? extends WebPage> getHomePage() {
        return HomePage.class;
    }

    /**
     * @see org.apache.wicket.Application#init()
     */

    @Override
    public void init() {
        super.init();

        // add your configuration here
    }
}

Run Start.java and hit the url 

Output

Apache Wicket How to start ?



Apache Wicket

Apache Wicket is a open source lightweight component-based web application framework for the Java programming language conceptually similar to JavaServer Faces and Tapestry.

Softwares Used

  • Eclipse Juno
  • Apache tomcat 6.0
  • Java 7
  • Maven with Wicket quickstart 

1. Create a Maven Project in eclipse.

File->New->Other->Maven->Maven Project

2. Select Wicket quickstart artifact

Or Use the below command to generate the archetype
mvn archetype:generate -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=7.2.0 -DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository=https://repository.apache.org/ -DinteractiveMode=false

3. Maven Project created with below structure.



4. Deploy this project in Tomcat

Right click on the project->Run As->Tomcat Server  Or Run the Start.java (Which is using Jetty server)

5.  output 


 






References

http://wicket.apache.org/

Confusion Matrix + Precision/Recall (Super Simple, With Examples)

  Confusion Matrix + Precision/Recall (Super Simple, With Examples) 1) Binary Classification Setup Binary classification means the model p...

Featured Posts