HTML Form action tag. Calling a parent relative UR

2020-07-10 08:37发布

问题:

I am trying to setup a HTML form (Actually .jsp in the context of a Spring-MVC Application).

Assuming I am at the URL:

example.com/first/second

and I want to call an action to

example.com/post

What should the Action look like?

I expected this to work:

<form:form method="post" action="../post">

But this doesn't work.

回答1:

Relative path to post in the parent directory: ... action="../post"

Relative path to post in the root directory: ... action="/post"