Skip to Content
Java Projects - Second Edition
book

Java Projects - Second Edition

by Peter Verhas
August 2018
Intermediate to advanced
524 pages
14h 45m
English
Packt Publishing
Content preview from Java Projects - Second Edition

Hello world servlet

Before getting into the technical details, let's create an extremely simple hello world servlet. To do it, we will set up a Gradle project with the build file, build.gradle, the servlet class in the src/main/java/packt/java9/by/example/mastermind/servlet/HelloWorld.java file, and, last but not least, we have to create the file src/main/webapp/WEB-INF/web.xml. The gradle.build file will look like the following:

apply plugin: 'java' apply plugin: 'war' apply from: 'https://raw.github.com/gretty-gradle-plugin/gretty/master/pluginScripts/gretty.plugin' repositories { jcenter() } targetCompatibility = "1.10" sourceCompatibility = "1.10" dependencies { providedCompile "javax.servlet:javax.servlet-api:3.1.0" testCompile 'junit:junit:4.12' ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java 11 Cookbook - Second Edition

Java 11 Cookbook - Second Edition

Nick Samoylov, Mohamed Sanaulla

Publisher Resources

ISBN: 9781789131895Supplemental Content