Robin Robin - 21 days ago 9
HTML Question

HTML Form action tag. Calling a parent relative URL

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.

Answer

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

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