9

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.

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
Robin
  • 3,512
  • 10
  • 39
  • 73
  • 4
    try to remove non valid ":form" part and use `
    `
    – antejan Jan 16 '13 at 16:59
  • 1
    Are you asking how to reference the parent directory, or the "root" directory? That is, do you always want to refer to `example.com/post`, or would you want to call `example.com/first/post` if the local path was `example.com/first/second/third`? – Dwight DeGroff Jan 16 '13 at 17:02
  • @antejan: I am using this .jsp in a Spring MVC-Application. Here you will need to set the forms like: – Robin Jan 16 '13 at 17:08
  • @DwightDeGroff Acutally this won't matter in my case. But I would be interessted in both, if possible ;) – Robin Jan 16 '13 at 17:08
  • 2
    Can you look at rendered html and give us what browser gets? – antejan Jan 16 '13 at 17:11
  • 1
    As @antejan suggested: you say "this doesn't work". What are your exact symptoms? Does it work if you specify an absolute path? – Dwight DeGroff Jan 16 '13 at 17:14
  • @antejan If you are still interessted, but I fixed the Problem as it seems. The ``, works correct, but I made a mistake in my App, so the data was handled the wrong way. Thank you very much for your contribution. – Robin Jan 16 '13 at 17:17

1 Answers1

22

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

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

Dwight DeGroff
  • 600
  • 3
  • 9