LoginSignup
2
2

More than 3 years have passed since last update.

画面遷移せずにHTMLで値を送る方法

Last updated at Posted at 2020-01-14

画面遷移せずにGETで値を送る方法のメモです。

HTMLで値をGET送信

a href="URL?属性名="値"

<body>
<a href="TestServlet?action=sample"></a>
</body>

Javaで値を受け取る

request.getParameter("属性名")
sは文字列「sample」を受け取ります。

protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

            String s = request.getParameter("action");
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2