0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[ TomCat ] インストールとサンプル表示のメモ

Posted at

サーバクライアント通信をするためには、
サーバが必要となる。

そこでTomCatをインストールすることにした。

インストール方法

以下のサイトがとても参考になった。
https://eng-entrance.com/java-servlet-tomcat-install

上記サイトの最後の項目「Webアプリケーションマネージャ有効化」
というところは行わなくても通信できたので、
今回は触れていない。

サンプルを用いた通信

テスト通信では以下のサイトがとても参考になった。
https://searchman.info/java_eclipse/1040.html

サンプル表示についても
上記のサイトに従って進めればできたので、
特にいうことはない。

コードの内容

web.xmlには
  ・サイトへのURL
  ・javaファイルのクラス名
が書かれている。

また、javaファイルには
  ・doGet()(サイトにアクセスしたとき最初に呼び出されるメソッド)
  ・PrintWriter型の変数(表示されるサイトのHTML文、F12で開ける)
が書かれている。

まとめ

ファイルに書かれていることを理解しておかないと、
サーバクライアント通信がうまく実装できないので、
気を付けたい。

以上。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?