Merge pull request #11562 from anuragkumawat/master

Adding spring-web-url
This commit is contained in:
kwoyke 2021-12-09 14:18:16 +01:00 committed by GitHub
commit 8838cb0b69
19 changed files with 98 additions and 8 deletions

View File

@ -7,10 +7,7 @@ This module contains articles about Spring MVC
- [A Custom Data Binder in Spring MVC](https://www.baeldung.com/spring-mvc-custom-data-binder)
- [Validating Lists in a Spring Controller](https://www.baeldung.com/spring-validate-list-controller)
- [Spring Validation Message Interpolation](https://www.baeldung.com/spring-validation-message-interpolation)
- [Using a Slash Character in Spring URLs](https://www.baeldung.com/spring-slash-character-in-url)
- [Using Enums as Request Parameters in Spring](https://www.baeldung.com/spring-enum-request-param)
- [Excluding URLs for a Filter in a Spring Web Application](https://www.baeldung.com/spring-exclude-filter)
- [Guide to Flash Attributes in a Spring Web Application](https://www.baeldung.com/spring-web-flash-attributes)
- [Handling URL Encoded Form Data in Spring REST](https://www.baeldung.com/spring-url-encoded-form-data)
- [Reading HttpServletRequest Multiple Times in Spring](https://www.baeldung.com/spring-reading-httpservletrequest-multiple-times)
- More articles: [[<-- prev]](/spring-mvc-basics-2)[[more -->]](/spring-mvc-basics-4)

View File

@ -0,0 +1,8 @@
## Spring Web URL
This module contains articles about Spring MVC
## Relevant articles:
- [Using a Slash Character in Spring URLs](https://www.baeldung.com/spring-slash-character-in-url)
- [Excluding URLs for a Filter in a Spring Web Application](https://www.baeldung.com/spring-exclude-filter)
- [Handling URL Encoded Form Data in Spring REST](https://www.baeldung.com/spring-url-encoded-form-data)

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-web-url</artifactId>
<name>spring-web-url</name>
<packaging>war</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-2</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
</build>
<properties>
<!-- The main class to start by executing java -jar -->
<start-class>com.baeldung.exclude_urls_filter.Application</start-class>
</properties>
</project>

View File

@ -2,11 +2,8 @@ package com.baeldung.exclude_urls_filter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@ComponentScan(basePackages = "com.baeldung.exclude_urls_filter")
@Configuration
@SpringBootApplication
public class Application {

View File

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("slash")
public class SlashParsingController {
public class SlashParsingController {
@GetMapping("mypaths/{anything}")
public String pathVariable(@PathVariable("anything") String anything) {

View File

@ -0,0 +1,4 @@
spring.thymeleaf.cache=false
spring.thymeleaf.enabled=true
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html

View File

@ -0,0 +1,41 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Poetry Contest: Submission</title>
</head>
<body>
<form action="#" method="post" th:action="@{/web/feedback}" th:object="${feedback}">
<table border='0' cellpadding='2' cellspacing='2' width='480px'>
<tr>
<td align='center'>
<label for="email">Email:</label>
</td>
<td>
<input th:field=*{emailId} type="text"/>
</td>
</tr>
<tr>
<td align='center'>
<label for="comment">Comment:</label>
</td>
<td>
<textarea cols="30" rows="30" th:field=*{comment}/>
</td>
</tr>
<tr>
<td align='center'>
<input type="submit" value="Submit Feedback">
</td>
</tr>
</table>
</form>
</body>
</html>