From bf57327d543d69b7522f22cbb867cad8de91373e Mon Sep 17 00:00:00 2001 From: daniellp20 Date: Thu, 18 Jan 2018 12:46:51 +0100 Subject: [PATCH 1/5] Borrado travis --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4d361b7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: java -jdk: - - oraclejdk8 - - openjdk8 - - oraclejdk9 From 3e97e7393fc4d8d0383368fc228a2f477823de00 Mon Sep 17 00:00:00 2001 From: daniellp20 Date: Thu, 18 Jan 2018 12:48:15 +0100 Subject: [PATCH 2/5] Subido travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f5c99a7 --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +language: java \ No newline at end of file From 749cdac0be289fe156ad3c3e1d8cabcb25d2b49a Mon Sep 17 00:00:00 2001 From: daniellp20 Date: Thu, 18 Jan 2018 12:53:10 +0100 Subject: [PATCH 3/5] Error introducido --- src/main/java/hello/Application.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/hello/Application.java b/src/main/java/hello/Application.java index 8cf206d..312f791 100644 --- a/src/main/java/hello/Application.java +++ b/src/main/java/hello/Application.java @@ -16,5 +16,5 @@ protected SpringApplicationBuilder configure(SpringApplicationBuilder applicatio public static void main(String[] args) { SpringApplication.run(Application.class, args); } - +fkfhkj } \ No newline at end of file From add5735f1f827d535bef628f0087d24921f9190c Mon Sep 17 00:00:00 2001 From: daniellp20 Date: Thu, 18 Jan 2018 13:16:43 +0100 Subject: [PATCH 4/5] Modificaciones --- src/main/java/hello/GreetingController.java | 2 ++ src/main/java/hello/GreetingTranslator.java | 16 ++++++++++++++++ src/main/resources/templates/greeting.html | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/main/java/hello/GreetingTranslator.java diff --git a/src/main/java/hello/GreetingController.java b/src/main/java/hello/GreetingController.java index 2a1631c..fa0653f 100644 --- a/src/main/java/hello/GreetingController.java +++ b/src/main/java/hello/GreetingController.java @@ -10,7 +10,9 @@ public class GreetingController { @RequestMapping("/greeting") public String greeting(@RequestParam(value="name", required=false, defaultValue="World") String name, + @RequestParam(value="lang", required=false, defaultValue="en") String lang, Model model) { + model.addAttribute("hello", greetingTranslator.sayHelloIn(lang)); model.addAttribute("name", name); return "greeting"; } diff --git a/src/main/java/hello/GreetingTranslator.java b/src/main/java/hello/GreetingTranslator.java new file mode 100644 index 0000000..b0aab03 --- /dev/null +++ b/src/main/java/hello/GreetingTranslator.java @@ -0,0 +1,16 @@ +package hello; + +public class GreetingTranslator { + + public String sayHelloIn(String lang) { + String hello; + if ("en".equals(lang)) { + hello = "hello"; + } else if ("es".equals(lang)) { + hello = "hola"; + } else { + hello = "no hablo tu idioma"; + } + } + +} \ No newline at end of file diff --git a/src/main/resources/templates/greeting.html b/src/main/resources/templates/greeting.html index aaeba56..0681620 100644 --- a/src/main/resources/templates/greeting.html +++ b/src/main/resources/templates/greeting.html @@ -5,6 +5,6 @@ -

+

\ No newline at end of file From 53378d1a7373ac4bb21f1be146cf00bf9ba9edd9 Mon Sep 17 00:00:00 2001 From: daniellp20 Date: Thu, 18 Jan 2018 13:22:28 +0100 Subject: [PATCH 5/5] Corregido el error --- src/main/java/hello/Application.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/hello/Application.java b/src/main/java/hello/Application.java index 312f791..8cf206d 100644 --- a/src/main/java/hello/Application.java +++ b/src/main/java/hello/Application.java @@ -16,5 +16,5 @@ protected SpringApplicationBuilder configure(SpringApplicationBuilder applicatio public static void main(String[] args) { SpringApplication.run(Application.class, args); } -fkfhkj + } \ No newline at end of file