commit 8d7ed4e8487d4efc593434d97c85c18c329205f5 Author: MAUREL Yoann Date: Mon Mar 4 18:16:31 2019 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a181cc2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,234 @@ + +# Created by https://www.gitignore.io/api/osx,java,linux,maven,eclipse,intellij +# Edit at https://www.gitignore.io/?templates=osx,java,linux,maven,eclipse,intellij + +### Eclipse ### + +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +### Eclipse Patch ### +# Eclipse Core +.project + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Annotation Processing +.apt_generated + +.sts4-cache/ + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Maven ### +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar + +### OSX ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# End of https://www.gitignore.io/api/osx,java,linux,maven,eclipse,intellij diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..27f51a5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + fr.istic.pr + pr.tp.web + war + 0.0.1-SNAPSHOT + + + UTF-8 + 8 + 8 + + + + + junit + junit + 3.8.1 + test + + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + + javax.servlet.jsp + javax.servlet.jsp-api + 2.3.3 + provided + + + + pr.tp.web + + + org.apache.tomcat.maven + tomcat7-maven-plugin + 2.2 + + http://localhost:8080/ + Tomcat + / + + + + + diff --git a/src/main/java/pr/tp/web/HelloServlet.java b/src/main/java/pr/tp/web/HelloServlet.java new file mode 100644 index 0000000..c833b25 --- /dev/null +++ b/src/main/java/pr/tp/web/HelloServlet.java @@ -0,0 +1,58 @@ +package pr.tp.web; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Enumeration; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet("/hello") +public class HelloServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Override + public void init(ServletConfig config) throws ServletException { + + Enumeration e2 = config.getInitParameterNames(); + while (e2.hasMoreElements()) { + String key = (String) e2.nextElement(); + String value = getInitParameter(key); + System.out.println(" " + key + " = " + value); + } + + + super.init(config); + } + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + PrintWriter out = response.getWriter(); + out.println(""); + out.println("Hello World"); + out.println(""); + String nom = request.getParameter("nom"); + if(nom!=null) { + out.println("Hello "+ nom); + }else { + out.println("Hello World"); + } + + ServletContext context = getServletContext(); + Enumeration e = context.getInitParameterNames(); + while (e.hasMoreElements()) { + String key = (String) e.nextElement(); + Object value = context.getInitParameter(key); + System.out.println(" " + key + " = " + value); + } + + + out.println(""); + out.println(""); + } + +} diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..9f88c1f --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + + Archetype Created Web Application + diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp new file mode 100644 index 0000000..a597615 --- /dev/null +++ b/src/main/webapp/index.jsp @@ -0,0 +1,16 @@ +<%@ page import="java.util.Date" %> + + +

Hello World!

+

Il est <%= new Date() %>

+ +
+
+La balise pre
+
+permet de conserver les retours à la ligne.
+
+
+ + +