dzilajace mapowanie plikow jsp

This commit is contained in:
lukasgol committed 2014-04-27 22:50:46 +02:00
1 parent 3991b6ebc3
commit 8b8726589e
5 files changed
+161 -2

No files matched your search

+5 -1
View File
@@ -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")
}
+15 -1
View File
@@ -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;
}
}
+1
View File
@@ -0,0 +1 @@
hello
+65
View File
@@ -0,0 +1,65 @@
<!doctype html>
<%@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" %>
<html>
<head>
<meta charset="utf-8">
<title>Spring MVC Application</title>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="http://getbootstrap.com/dist/css/bootstrap-responsive.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Users</h1>
<form:form method="post" action="addRole" commandName="role" role="form">
<div class="form-group">
<form:label path="role">Role:</form:label>
<jsp:useBean id="userAuthRoles" class="com.springapp.mvc.UserLevel" scope="page"/>
<form:select id="role" path="role">
<c:forEach var="item" items="${userAuthRoles.items}">
<form:option value="${item}">${item}</form:option>
</c:forEach>
</form:select>
</div>
<div class="form-group">
<form:label path="password">Password:</form:label>
<form:input path="password" class="form-control" placeholder="Password"/>
</div>
<button type="submit" class="btn btn-default">Add Password for role</button>
</form:form>
<c:if test="${!empty roles}">
<h3>Roles</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Role</th>
<th>Pass</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<c:forEach items="${roles}" var="role">
<tr>
<td>${role.role}</td>
<td>${role.password}</td>
<td>
<p>TODO delete button</p>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>
</div>
</body>
</html>
+75
View File
@@ -0,0 +1,75 @@
<!doctype html>
<%@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" %>
<html>
<head>
<meta charset="utf-8">
<title>Spring MVC Application</title>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="http://getbootstrap.com/dist/css/bootstrap-responsive.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>Users</h1>
<form:form method="post" action="add" commandName="user" role="form">
<div class="form-group">
<form:label path="firstName">First Name:</form:label>
<form:input path="firstName" class="form-control" placeholder="First Name"/>
</div>
<div class="form-group">
<form:label path="lastName">Last Name:</form:label>
<form:input path="lastName" class="form-control" placeholder="Last Name"/>
</div>
<div class="form-group">
<form:label path="email">Email:</form:label>
<form:input path="email" class="form-control" placeholder="Email"/>
</div>
<div class="form-group">
<form:label path="role">Role:</form:label>
<form:select id="role" path="role">
<c:forEach var="item" items="${userAuthRoles.items}">
<form:option value="${item}">${item}</form:option>
</c:forEach>
</form:select>
</div>
<button type="submit" class="btn btn-default">Add User</button>
</form:form>
<c:if test="${!empty users}">
<h3>Users</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<c:forEach items="${users}" var="user">
<tr>
<td>${user.lastName}, ${user.firstName}</td>
<td>${user.email}</td>
<td>
<form:form action="delete/${user.id}" method="post"><input type="submit"
class="btn btn-danger btn-mini"
value="Delete"/>
</form:form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>
</div>
</body>
</html>