diff --git a/build.gradle b/build.gradle index bc22ccb..4251099 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ apply plugin: 'war' -jar { +war { baseName = 'nfc_server' version = '0.1.0' } @@ -36,4 +36,8 @@ dependencies { compile 'org.json:json:20080701' compile("org.springframework.boot:spring-boot-starter-web") + providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") + testCompile("org.springframework.boot:spring-boot-starter-test") + providedRuntime("javax.servlet:jstl") + providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper") } \ No newline at end of file diff --git a/src/main/java/application/Config.java b/src/main/java/application/Config.java index a94f6c9..5313e23 100644 --- a/src/main/java/application/Config.java +++ b/src/main/java/application/Config.java @@ -3,12 +3,16 @@ package application; import application.utils.TokensGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.web.servlet.view.InternalResourceViewResolver; +import org.springframework.web.servlet.view.JstlView; /** * Created by lukasgol on 01.04.14. @@ -18,7 +22,7 @@ import org.springframework.scheduling.annotation.Scheduled; @EnableAutoConfiguration @ImportResource("Spring-Module.xml") @EnableScheduling -public class Config { +public class Config extends SpringBootServletInitializer { @Scheduled(fixedRate = 50000) public void generatePassword() { @@ -30,5 +34,15 @@ public class Config { ConfigurableApplicationContext context = SpringApplication.run(Config.class, args); } + @Bean + public InternalResourceViewResolver internalResourceViewResolver() { + InternalResourceViewResolver resolver = new InternalResourceViewResolver(); + resolver.setPrefix("WEB-INF/views/"); + resolver.setSuffix(".jsp"); + resolver.setViewClass(JstlView.class); + return resolver; + } + + } diff --git a/src/main/webapp/WEB-INF/views/hello.jsp b/src/main/webapp/WEB-INF/views/hello.jsp new file mode 100644 index 0000000..b6fc4c6 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/hello.jsp @@ -0,0 +1 @@ +hello \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/roles.jsp b/src/main/webapp/WEB-INF/views/roles.jsp new file mode 100644 index 0000000..64c43d3 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/roles.jsp @@ -0,0 +1,65 @@ + +<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %> +<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %> +<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + + + + + Spring MVC Application + + + + + + + + + +
+

Users

+ +
+ Role: + + + + ${item} + + +
+ +
+ Password: + +
+ + +
+ + +

Roles

+ + + + + + + + + + + + + + + + + +
RolePass 
${role.role}${role.password} +

TODO delete button

+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/users.jsp b/src/main/webapp/WEB-INF/views/users.jsp new file mode 100644 index 0000000..7237430 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/users.jsp @@ -0,0 +1,75 @@ + +<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %> +<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %> +<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + + + + + Spring MVC Application + + + + + + + + + +
+

Users

+ +
+ First Name: + +
+
+ Last Name: + +
+
+ Email: + +
+ +
+ Role: + + + ${item} + + +
+ + +
+ + +

Users

+ + + + + + + + + + + + + + + + + +
NameEmail 
${user.lastName}, ${user.firstName}${user.email} + + +
+
+
+ + \ No newline at end of file