JAVA-3526: Moved spring-mvc-java inside spring-web-modules
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Spring MVC - Integration Testing</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans
|
||||
xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
|
||||
<mvc:annotation-driven />
|
||||
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div th:fragment="footer1">© 2013 Footer</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<span th:text="#{welcome.text}">Hi</span>
|
||||
<span th:text="${name}"> John </span>!
|
||||
<span custom:name="James">Test</span>
|
||||
<div th:replace="footer :: footer1">© 2013 The Static
|
||||
Templates</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Thymeleaf Spring Example</title>
|
||||
</head>
|
||||
<body>
|
||||
Hello John!
|
||||
<br></br>
|
||||
<div>Please confirm your details</div>
|
||||
<br></br>
|
||||
<form action="#" th:action="@{/processForm}" th:object="${user}"
|
||||
method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Firstname :</td>
|
||||
<td><input type="text" value="Firstname"
|
||||
th:field="*{firstname}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Lastname :</td>
|
||||
<td><input type="text" value="Lastname"
|
||||
th:field="*{lastname}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>EmailId :</td>
|
||||
<td><input type="text" value="emailId"
|
||||
th:field="*{emailId}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><input type="submit" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<form action="#" th:action="@{/message/processForm}" method="post">
|
||||
Message: <input type="text" value="message" id="message" name="message"/>
|
||||
<input type="submit" />
|
||||
</form>
|
||||
|
||||
<span th:text="${message}" id="received"></span>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,50 @@
|
||||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
|
||||
pageEncoding="ISO-8859-1"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Excel Processing</title>
|
||||
</head>
|
||||
<body>
|
||||
<c:url value="/uploadExcelFile" var="uploadFileUrl" />
|
||||
<c:url value="/excelProcessing" var="resetUrl" />
|
||||
<c:url value="/readPOI" var="readPOIUrl" />
|
||||
|
||||
<form method="post" enctype="multipart/form-data" action="${uploadFileUrl}">
|
||||
<input type="file" name="file" accept=".xls,.xlsx" />
|
||||
<input type="submit" value="Upload file" />
|
||||
</form>
|
||||
<br />
|
||||
<form method="GET" action="${resetUrl}">
|
||||
<input type="submit" value="Reset" />
|
||||
</form>
|
||||
<br /> ${message }
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<form action="${readPOIUrl }">
|
||||
<input type="submit" value="Display file content" />
|
||||
</form>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<c:if test="${not empty data}">
|
||||
<table style="border: 1px solid black; border-collapse: collapse;">
|
||||
<c:forEach items="${data}" var="row">
|
||||
<tr>
|
||||
<c:forEach items="${row.value}" var="cell">
|
||||
<td style="border:1px solid black;height:20px;width:100px;
|
||||
background-color:${cell.bgColor};color:${cell.textColor};
|
||||
font-weight:${cell.textWeight};font-size:${cell.textSize}pt;">
|
||||
${cell.content}
|
||||
</td>
|
||||
</c:forEach>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</table>
|
||||
</c:if>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,107 @@
|
||||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>File Upload Example</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>Enter The File to Upload (Single file)</h3>
|
||||
|
||||
<form:form method="POST" action="/spring-mvc-java/uploadFile" enctype="multipart/form-data">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Select a file to upload</td>
|
||||
<td><input type="file" name="file" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" value="Submit" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form:form>
|
||||
|
||||
<br />
|
||||
|
||||
<h3>Enter The Files to Upload (Multiple files)</h3>
|
||||
|
||||
<form:form method="POST" action="/spring-mvc-java/uploadMultiFile" enctype="multipart/form-data">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Select a file to upload</td>
|
||||
<td><input type="file" name="files" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select a file to upload</td>
|
||||
<td><input type="file" name="files" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select a file to upload</td>
|
||||
<td><input type="file" name="files" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" value="Submit" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form:form>
|
||||
|
||||
<br />
|
||||
|
||||
<h3>Fill the Form and Select a File (<code>@RequestParam</code>)</h3>
|
||||
|
||||
<form:form method="POST" action="/spring-mvc-java/uploadFileWithAddtionalData" enctype="multipart/form-data">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td><input type="text" name="name" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email</td>
|
||||
<td><input type="text" name="email" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select a file to upload</td>
|
||||
<td><input type="file" name="file" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" value="Submit" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form:form>
|
||||
|
||||
<br />
|
||||
|
||||
<h3>Fill the Form and Select a File (<code>@ModelAttribute</code>)</h3>
|
||||
|
||||
<form:form method="POST" action="/spring-mvc-java/uploadFileModelAttribute" enctype="multipart/form-data">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td><input type="text" name="name" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email</td>
|
||||
<td><input type="text" name="email" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select a file to upload</td>
|
||||
<td><input type="file" name="file" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" value="Submit" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form:form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,79 @@
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Spring MVC File Upload</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>Submitted File (Single)</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>OriginalFileName :</td>
|
||||
<td>${file.originalFilename}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type :</td>
|
||||
<td>${file.contentType}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
|
||||
<h2>Submitted Files (Multiple)</h2>
|
||||
<table>
|
||||
<c:forEach items="${files}" var="file">
|
||||
<tr>
|
||||
<td>OriginalFileName :</td>
|
||||
<td>${file.originalFilename}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type :</td>
|
||||
<td>${file.contentType}</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</table>
|
||||
<br />
|
||||
|
||||
<h2>Submitted File with Data (<code>@RequestParam</code>)</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Name :</td>
|
||||
<td>${name}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email :</td>
|
||||
<td>${email}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OriginalFileName :</td>
|
||||
<td>${file.originalFilename}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type :</td>
|
||||
<td>${file.contentType}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<h2>Submitted File with Data (<code>@ModelAttribute</code>)</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Name :</td>
|
||||
<td>${formDataWithFile.name}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email :</td>
|
||||
<td>${formDataWithFile.email}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OriginalFileName :</td>
|
||||
<td>${formDataWithFile.file.originalFilename}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type :</td>
|
||||
<td>${formDataWithFile.file.contentType}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,66 @@
|
||||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
|
||||
pageEncoding="ISO-8859-1" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="ISO-8859-1">
|
||||
<title>Company Data</title>
|
||||
<script src="https://code.jquery.com/jquery-3.1.0.js"
|
||||
integrity="sha256-slogkvB1K3VOkzAI8QITxV3VzpOnkeNVsKvtkYLMjfk="
|
||||
crossorigin="anonymous"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#ResponseBody-button').click(function() {
|
||||
$.ajax({
|
||||
url: 'http://localhost:8080/spring-mvc-java/companyResponseBody?callback=getCompanyData',
|
||||
data: {
|
||||
format: 'json'
|
||||
},
|
||||
type: 'GET',
|
||||
jsonpCallback:'getCompanyData',
|
||||
dataType: 'jsonp',
|
||||
error: function() {
|
||||
$('#infoResponseBody').html('<p>An error has occurred</p>');
|
||||
},
|
||||
success: function(data) {
|
||||
console.log("sucess");
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#ResponseEntity-button').click(function() {
|
||||
console.log("ResponseEntity");
|
||||
$.ajax({
|
||||
url: 'http://localhost:8080/spring-mvc-java/companyResponseEntity?callback=getCompanyData',
|
||||
data: {
|
||||
format: 'json'
|
||||
},
|
||||
type: 'GET',
|
||||
jsonpCallback:'getCompanyData',
|
||||
dataType: 'jsonp',
|
||||
error: function() {
|
||||
$('#infoResponseEntity').html('<p>An error has occurred</p>');
|
||||
},
|
||||
success: function(data) {
|
||||
console.log("sucess");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function getCompanyData(data) {
|
||||
$("#response").append("<b>ID:</b> "+data.id+"<br/>");
|
||||
$("#response").append("<b>NAME:</b> "+data.name+"<br/>");
|
||||
$("#response").append("<br/>");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!--Using @ResponseBody -->
|
||||
<button id="ResponseBody-button">Send AJAX JSON-P request!</button>
|
||||
|
||||
<div id="response"></div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<head></head>
|
||||
|
||||
<body>
|
||||
<h1>This is the body of the sample view</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
xsi:schemaLocation="
|
||||
http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"
|
||||
>
|
||||
|
||||
<display-name>Spring MVC Application</display-name>
|
||||
|
||||
<!-- Spring root -->
|
||||
<context-param>
|
||||
<param-name>contextClass</param-name>
|
||||
<param-value>
|
||||
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
|
||||
</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>com.baeldung.spring.web.config</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Spring child -->
|
||||
<servlet>
|
||||
<servlet-name>mvc</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>mvc</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,6 @@
|
||||
$(function() {
|
||||
var node1 = document.createTextNode("message = " + message);
|
||||
var node2 = document.createTextNode("number = " + number);
|
||||
document.getElementById('message-async-jquery').append(node1);
|
||||
document.getElementById('number-async-jquery').append(node2);
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
window.onload = function() {
|
||||
var node1 = document.createTextNode("message = " + message);
|
||||
var node2 = document.createTextNode("number = " + number);
|
||||
document.getElementById('message-async').append(node1);
|
||||
document.getElementById('number-async').append(node2);
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
var node1 = document.createTextNode("message = " + message);
|
||||
var node2 = document.createTextNode("number = " + number);
|
||||
document.getElementById('message-ext').append(node1);
|
||||
document.getElementById('number-ext').append(node2);
|
||||
Reference in New Issue
Block a user