Skip to content

Commit 33393e3

Browse files
committed
Added getting started example application
1 parent 2ce977c commit 33393e3

File tree

6 files changed

+101
-0
lines changed

6 files changed

+101
-0
lines changed

getting-started/pom.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.mscharhag.javaee8.mvc</groupId>
8+
<artifactId>getting-started</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<packaging>war</packaging>
11+
12+
<dependencies>
13+
<dependency>
14+
<groupId>com.oracle.ozark</groupId>
15+
<artifactId>ozark</artifactId>
16+
<version>1.0.0-m01</version>
17+
<scope>compile</scope>
18+
</dependency>
19+
<dependency>
20+
<groupId>javax</groupId>
21+
<artifactId>javaee-api</artifactId>
22+
<version>7.0</version>
23+
</dependency>
24+
</dependencies>
25+
26+
<build>
27+
<finalName>java-ee-8-getting-started</finalName>
28+
</build>
29+
30+
<properties>
31+
<maven.compiler.source>1.8</maven.compiler.source>
32+
<maven.compiler.target>1.8</maven.compiler.target>
33+
<failOnMissingWebXml>false</failOnMissingWebXml>
34+
</properties>
35+
36+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.mscharhag.javaee8.mvc.getstarted;
2+
3+
import javax.ws.rs.ApplicationPath;
4+
import javax.ws.rs.core.Application;
5+
6+
@ApplicationPath("getting-started")
7+
public class GettingStartedApplication extends Application {
8+
9+
public GettingStartedApplication() {
10+
11+
}
12+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.mscharhag.javaee8.mvc.getstarted;
2+
3+
import com.oracle.ozark.core.Models;
4+
5+
import javax.inject.Inject;
6+
import javax.mvc.Controller;
7+
import javax.ws.rs.GET;
8+
import javax.ws.rs.Path;
9+
import javax.ws.rs.QueryParam;
10+
11+
@Controller
12+
@Path("hello")
13+
public class HelloController {
14+
15+
@Inject
16+
Models models;
17+
18+
@GET
19+
public String sayHello(@QueryParam("name") String name) {
20+
this.models.put("text", "Hello " + name);
21+
return "/WEB-INF/jsp/hello.jsp";
22+
}
23+
24+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
5+
bean-discovery-mode="all">
6+
</beans>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<%@page contentType="text/html" pageEncoding="UTF-8"%>
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6+
<title>Getting started</title>
7+
</head>
8+
<body>
9+
<p>Getting started (hello.jsp)</p>
10+
<h1>${text}</h1>
11+
</body>
12+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Getting started</title>
5+
<meta charset="UTF-8">
6+
</head>
7+
<body>
8+
<p>Getting started (index.html)</p>
9+
<a href="getting-started/hello?name=john">getting-started/hello?name=john</a>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)