Thymeleaf and SpringMVC, how to use pathvariableHow do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?how can I refer to another mapped controller in spring mvc?Overriding RequestMapping on SpringMVC controllerHow does <form> action works?SpringMVC: Set pathvariable using form data@restcontroller and @responsebody not working in Spring MVC + Thymeleafhow to bind HTML5 and SpringMVC 4 using Thymeleaf?How to bind an object list with thymeleaf?(Spring, Thymeleaf) How to request to controller 'POST' with list of model inside a model?How to disable trimming of whitespace when getting form data with using Thymeleaf in Spring
Is the destination of a commercial flight important for the pilot?
Coordinate position not precise
Mapping a list into a phase plot
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
What defines a dissertation?
How was Earth single-handedly capable of creating 3 of the 4 gods of chaos?
How to be diplomatic in refusing to write code that breaches the privacy of our users
Is there any reason not to eat food that's been dropped on the surface of the moon?
How does it work when somebody invests in my business?
What's a natural way to say that someone works somewhere (for a job)?
How to combine multiple text files of different lengths and multiple columns by a column
Personal Teleportation as a Weapon
Why "be dealt cards" rather than "be dealing cards"?
Generic lambda vs generic function give different behaviour
Opposite of a diet
Why is delta-v is the most useful quantity for planning space travel?
Why are on-board computers allowed to change controls without notifying the pilots?
Lay out the Carpet
Have I saved too much for retirement so far?
Is it correct to write "is not focus on"?
How to verify if g is a generator for p?
Your magic is very sketchy
Everything Bob says is false. How does he get people to trust him?
apt-get update is failing in debian
Thymeleaf and SpringMVC, how to use pathvariable
How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?how can I refer to another mapped controller in spring mvc?Overriding RequestMapping on SpringMVC controllerHow does <form> action works?SpringMVC: Set pathvariable using form data@restcontroller and @responsebody not working in Spring MVC + Thymeleafhow to bind HTML5 and SpringMVC 4 using Thymeleaf?How to bind an object list with thymeleaf?(Spring, Thymeleaf) How to request to controller 'POST' with list of model inside a model?How to disable trimming of whitespace when getting form data with using Thymeleaf in Spring
My Controller looks like this:
@RestController
class MockRestController {
@RequestMapping(method = [RequestMethod.POST], value = ["/mocks/id/start"])
fun startMock(@PathVariable id: String): ResponseEntity<String>
...
This works perfectly:
<h1 class="title is-2">
Mock #[[$id]] control page
</h1>
However, my form action doesn't work:
<form action="/mocks/$id/start" method="post">
How can I use it?
spring-mvc thymeleaf
add a comment |
My Controller looks like this:
@RestController
class MockRestController {
@RequestMapping(method = [RequestMethod.POST], value = ["/mocks/id/start"])
fun startMock(@PathVariable id: String): ResponseEntity<String>
...
This works perfectly:
<h1 class="title is-2">
Mock #[[$id]] control page
</h1>
However, my form action doesn't work:
<form action="/mocks/$id/start" method="post">
How can I use it?
spring-mvc thymeleaf
add a comment |
My Controller looks like this:
@RestController
class MockRestController {
@RequestMapping(method = [RequestMethod.POST], value = ["/mocks/id/start"])
fun startMock(@PathVariable id: String): ResponseEntity<String>
...
This works perfectly:
<h1 class="title is-2">
Mock #[[$id]] control page
</h1>
However, my form action doesn't work:
<form action="/mocks/$id/start" method="post">
How can I use it?
spring-mvc thymeleaf
My Controller looks like this:
@RestController
class MockRestController {
@RequestMapping(method = [RequestMethod.POST], value = ["/mocks/id/start"])
fun startMock(@PathVariable id: String): ResponseEntity<String>
...
This works perfectly:
<h1 class="title is-2">
Mock #[[$id]] control page
</h1>
However, my form action doesn't work:
<form action="/mocks/$id/start" method="post">
How can I use it?
spring-mvc thymeleaf
spring-mvc thymeleaf
edited Mar 7 at 13:29
Alien
5,47331127
5,47331127
asked Mar 7 at 11:46
JohnJohn
174114
174114
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
try like this. here $id contains your variable value.
<form th:action="@/mocks/id/start(id=$id)" method="post">
It is not working.
– John
Mar 8 at 0:59
add a comment |
It is working.
<form th:action="@'/mocks/' + $id + '/start'" method="post">
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043032%2fthymeleaf-and-springmvc-how-to-use-pathvariable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
try like this. here $id contains your variable value.
<form th:action="@/mocks/id/start(id=$id)" method="post">
It is not working.
– John
Mar 8 at 0:59
add a comment |
try like this. here $id contains your variable value.
<form th:action="@/mocks/id/start(id=$id)" method="post">
It is not working.
– John
Mar 8 at 0:59
add a comment |
try like this. here $id contains your variable value.
<form th:action="@/mocks/id/start(id=$id)" method="post">
try like this. here $id contains your variable value.
<form th:action="@/mocks/id/start(id=$id)" method="post">
answered Mar 7 at 13:14
Aritra PaulAritra Paul
465212
465212
It is not working.
– John
Mar 8 at 0:59
add a comment |
It is not working.
– John
Mar 8 at 0:59
It is not working.
– John
Mar 8 at 0:59
It is not working.
– John
Mar 8 at 0:59
add a comment |
It is working.
<form th:action="@'/mocks/' + $id + '/start'" method="post">
add a comment |
It is working.
<form th:action="@'/mocks/' + $id + '/start'" method="post">
add a comment |
It is working.
<form th:action="@'/mocks/' + $id + '/start'" method="post">
It is working.
<form th:action="@'/mocks/' + $id + '/start'" method="post">
answered Mar 8 at 0:59
JohnJohn
174114
174114
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043032%2fthymeleaf-and-springmvc-how-to-use-pathvariable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown