Quantcast
Channel: 質問!ITmedia 新着質問(Java/253)
Viewing all articles
Browse latest Browse all 2439

Tomcatを使用したWebログイン画面

$
0
0
Tomcatを使用して、 サーバ(logintest.html)にブラウザからアクセスしてログイン画面を表示させます。 ユーザIDがuser、パスワードがpasswordだった場合は「ログイン成功」と表示し、それ以外は「ログイン失敗」と表示させます。 Servletのソース(loginteset.java)がコンパイルエラーになります。 アドバイスをいただけませんか? logintest.html Login
  ユーザIDを入力してください :

  パスワードを入力してください :

logintest.java import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class FormServletTest extends HttpServlet { public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html;charset=Windows-31J"); } String id = request.getParameter("userid"); String pass = request.getParameter("userpass"); if(id.equals("user") && pass.equals("password")){ out.println("ログイン成功"); } else { out.println("ログイン失敗"); } }

Viewing all articles
Browse latest Browse all 2439

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>