JSP form path

Servlet / JSP form path

About the action path of form

Under development in eclipse I was worried about the form path, so I recorded it

test.jsp From Of the Servlet class ~~RetweetBot2.java~~ foo.java Path when you want to send parameters to

The qualified names of ~~ RetweetBot2.java ~~ foo.java are as follows. /sample/src/pkg/foo.java

↓ code gives a 404 error

test.jsp


<form action="/sample/src/pkg/foo" method="post">
    <p>Enter the text you want to send:
      <input type="text" name="hoge"></p>
      <input type="submit" value="Send">
</form>

。。。。

If it is the code of ↓, the transmission was successful.

test.jsp


<form action="/sample/foo" method="post">
    <p>Enter the text you want to send:
      <input type="text" name="hoge"></p>
      <input type="submit" value="Send">
</form>

The reason is studying. Still unknown.

I will add it if I understand it.

・ 2019/04/06 correction Because there was an error in the Servlet class name (Error) RetweetBot2.java → (Correct) foo.java I fixed it to.

Recommended Posts

JSP form path
From (form)