RequestDispatcherServletSuccess.java 718 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
package com.roshka.bootcamp;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

12
@WebServlet("/success")
13 14 15 16 17 18 19 20 21 22 23 24
public class RequestDispatcherServletSuccess extends HttpServlet {

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

        String n = request.getParameter("username");
        out.print("Welcome " + n);

    }
}