*//post method*
protected void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException {
String username = req.getParameter("username");
String password = req.getParameter("password");
System.out.println(" Form data recieved .. Now Verifying ");
if (loginVerificator (username, password)) {
Cookie xO = new Cookie ("username", username);
Cookie xT = new Cookie ("password", password);
res.addCookie(xO);
res.addCookie(xT);
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<meta http-equiv=\"refresh\" content=\"2\";url=\"home\">");
}
postメソッドは、フォームパラメータを取得してからフォームパラメータを取得し、それらのCookieをレスポンスに追加します。次に、メタタグでページをリダイレクトします。(メタタグを使用して)リダイレクトする代わりにサーブレットページをリフレッシュ/リロードするのはなぜですか?
リダイレクトではなく、このページがリロードされている理由を知りたいと思います。私が間違っている場所を見つけることができません。 URLは、コンテンツ属性値の引用符でラップされていないとして、誤っている
<meta http-equiv="refresh" content="2";url="home">
:
thanx airst Sir。 –
ようこそ。 –