[JAVA-13854] Half list moved (#12598)
* [JAVA-13854] added parent module * [JAVA-13854] moved apache-tapestry(submodule) to web-modules(parent) * [JAVA-13854] moved bootique(submodule) to web-modules(parent) * [JAVA-13854] moved dropwizard(submodule) to web-modules(parent) * [JAVA-13854] moved blade(submodule) to web-modules(parent) * [JAVA-13854] moved java-lite(submodule) to web-modules(parent) * [JAVA-13854] moved jooby(submodule) to web-modules(parent) * [JAVA-13854] moved linkrest(submodule) to web-modules(parent) * [JAVA-13854] moved ninja(submodule) to web-modules(parent) * [JAVA-13854] moved ratpack(submodule) to web-modules(parent) * [JAVA-13854] moved resteasy(submodule) to web-modules(parent) * [JAVA-13854] moved restx(submodule) to web-modules(parent) * [JAVA-13854] moved spark-java(submodule) to web-modules(parent) * [JAVA-13854] moved vraptor(submodule) to web-modules(parent) * [JAVA-13854] delete modules that were moved * [JAVA-13854] * [JAVA-13854] * [JAVA-13854] delete ninja submodule + moved raml(submodule) to web-modules(parent) * [JAVA-13854] moved gwt(submodule) to web-modules(parent) * [JAVA-13854] moved jakarta-ee(submodule) to web-modules(parent) * [JAVA-13854] moved javax-servlets(submodule) to web-modules(parent) * [JAVA-13854] moved javax-servlets-2(submodule) to web-modules(parent) * [JAVA-13854] moved jee-7(submodule) to web-modules(parent) * [JAVA-13854] moved play-framework(not a module) to web-modules * [JAVA-13854] fix failing test * [JAVA-13854] moved struts-2(submodule) to web-modules(parent) * [JAVA-13854] moved wicket(submodule) to web-modules(parent) * [JAVA-13854] deleted modules that were moved to web-modules * JAVA-13854 Removed moved modules from the main pom.xml Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com> Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
## Wicket
|
||||
|
||||
This module contains articles about Wicket
|
||||
|
||||
### Relevant Articles
|
||||
|
||||
- [Introduction to the Wicket Framework](https://www.baeldung.com/intro-to-the-wicket-framework)
|
||||
|
||||
### Execution
|
||||
|
||||
From the same directory where pom.xml is, execute the following command to run the project:
|
||||
|
||||
`mvn jetty:run`
|
||||
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung.wicket.examples</groupId>
|
||||
<artifactId>wicket</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>wicket</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>web-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!-- WICKET DEPENDENCIES -->
|
||||
<dependency>
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket-core</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
</dependency>
|
||||
<!-- JETTY DEPENDENCIES FOR TESTING -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.aggregate</groupId>
|
||||
<artifactId>jetty-all</artifactId>
|
||||
<version>${jetty9.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/test/java</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</testResource>
|
||||
</testResources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>${maven-war-plugin.version}</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>${jetty9.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<wicket.version>7.5.0</wicket.version>
|
||||
<jetty9.version>9.2.13.v20150730</jetty9.version>
|
||||
<maven-war-plugin.version>2.6</maven-war-plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Wicket Intro Examples</title>
|
||||
<style type="text/css" media="screen">
|
||||
<!--
|
||||
body {
|
||||
margin: 0px
|
||||
}
|
||||
|
||||
#horizon {
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
overflow: visible;
|
||||
visibility: visible;
|
||||
display: block
|
||||
}
|
||||
|
||||
#content {
|
||||
font-family: Verdana, Geneva, Arial, sans-serif;
|
||||
margin-left: -250px;
|
||||
position: absolute;
|
||||
top: -35px;
|
||||
left: 50%;
|
||||
width: 500px;
|
||||
height: 70px;
|
||||
visibility: visible
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="horizon">
|
||||
<div id="content">
|
||||
<div>
|
||||
<h3>Wicket Introduction Examples:</h3>
|
||||
<wicket:link>
|
||||
<a href="helloworld/HelloWorld.html">Hello World!</a>
|
||||
<br />
|
||||
<br />
|
||||
<a href="cafeaddress/CafeAddress.html">Cafes</a>
|
||||
</wicket:link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.baeldung.wicket.examples;
|
||||
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
|
||||
public class HelloWorld extends WebPage {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.baeldung.wicket.examples;
|
||||
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.protocol.http.WebApplication;
|
||||
|
||||
import com.baeldung.wicket.examples.cafeaddress.CafeAddress;
|
||||
|
||||
public class HelloWorldApplication extends WebApplication {
|
||||
/**
|
||||
* @see org.apache.wicket.Application#getHomePage()
|
||||
*/
|
||||
@Override
|
||||
public Class<? extends WebPage> getHomePage() {
|
||||
return HelloWorld.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.wicket.Application#init()
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
mountPage("/examples/helloworld", HelloWorld.class);
|
||||
mountPage("/examples/cafes", CafeAddress.class);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Cafes</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width: 800px; margin: 0 auto;">
|
||||
<select wicket:id="cafes"></select>
|
||||
<p>
|
||||
Address: <span wicket:id="address">address</span>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.baeldung.wicket.examples.cafeaddress;
|
||||
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
import org.apache.wicket.markup.html.form.DropDownChoice;
|
||||
import org.apache.wicket.model.PropertyModel;
|
||||
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CafeAddress extends WebPage {
|
||||
private String selectedCafe;
|
||||
private Address address;
|
||||
private Map<String, Address> cafeNamesAndAddresses = new HashMap<>();
|
||||
|
||||
public CafeAddress(final PageParameters parameters) {
|
||||
super(parameters);
|
||||
initCafes();
|
||||
|
||||
ArrayList<String> cafeNames = new ArrayList<>(cafeNamesAndAddresses.keySet());
|
||||
selectedCafe = cafeNames.get(0);
|
||||
address = new Address(cafeNamesAndAddresses.get(selectedCafe).getAddress());
|
||||
|
||||
final Label addressLabel = new Label("address", new PropertyModel<String>(this.address, "address"));
|
||||
addressLabel.setOutputMarkupId(true);
|
||||
|
||||
final DropDownChoice<String> cafeDropdown = new DropDownChoice<>("cafes", new PropertyModel<>(this, "selectedCafe"), cafeNames);
|
||||
cafeDropdown.add(new AjaxFormComponentUpdatingBehavior("onchange") {
|
||||
@Override
|
||||
protected void onUpdate(AjaxRequestTarget target) {
|
||||
String name = (String) cafeDropdown.getDefaultModel().getObject();
|
||||
address.setAddress(cafeNamesAndAddresses.get(name).getAddress());
|
||||
target.add(addressLabel);
|
||||
}
|
||||
});
|
||||
|
||||
add(addressLabel);
|
||||
add(cafeDropdown);
|
||||
|
||||
}
|
||||
|
||||
private void initCafes() {
|
||||
this.cafeNamesAndAddresses.put("Linda's Cafe", new Address("35 Bower St."));
|
||||
this.cafeNamesAndAddresses.put("Old Tree", new Address("2 Edgware Rd."));
|
||||
}
|
||||
|
||||
class Address implements Serializable {
|
||||
private String sAddress = "";
|
||||
|
||||
public Address(String address) {
|
||||
this.sAddress = address;
|
||||
}
|
||||
|
||||
String getAddress() {
|
||||
return this.sAddress;
|
||||
}
|
||||
|
||||
void setAddress(String address) {
|
||||
this.sAddress = address;
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<span wicket:id="hello"></span>
|
||||
</body>
|
||||
</html>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.baeldung.wicket.examples.helloworld;
|
||||
|
||||
import org.apache.wicket.markup.html.WebPage;
|
||||
import org.apache.wicket.markup.html.basic.Label;
|
||||
|
||||
public class HelloWorld extends WebPage {
|
||||
public HelloWorld() {
|
||||
add(new Label("hello", "Hello World!"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.baeldung.wicket.examples;
|
||||
|
||||
import org.apache.wicket.util.tester.WicketTester;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class HomePageIntegrationTest {
|
||||
private WicketTester tester;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
tester = new WicketTester(new HelloWorldApplication());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenPageInvoked_thanRenderedOK() {
|
||||
//start and render the test page
|
||||
tester.startPage(HelloWorld.class);
|
||||
|
||||
//assert rendered page class
|
||||
tester.assertRenderedPage(HelloWorld.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
|
||||
<display-name>CafeAddress</display-name>
|
||||
|
||||
<!--
|
||||
There are three means to configure Wickets configuration mode and they
|
||||
are tested in the order given.
|
||||
|
||||
1) A system property: -Dwicket.configuration
|
||||
2) servlet specific <init-param>
|
||||
3) context specific <context-param>
|
||||
|
||||
The value might be either "development" (reloading when templates change) or
|
||||
"deployment". If no configuration is found, "development" is the default. -->
|
||||
|
||||
<filter>
|
||||
<filter-name>wicket.examples</filter-name>
|
||||
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>applicationClassName</param-name>
|
||||
<param-value>com.baeldung.wicket.examples.HelloWorldApplication</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>wicket.examples</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
</web-app>
|
||||
Reference in New Issue
Block a user