Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import java.io.IOException;
- import java.io.PrintWriter;
- import javax.servlet.ServletException;
- import javax.servlet.annotation.WebServlet;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- /**
- * Servlet implementation class FirstServlet
- */
- @WebServlet("/FirstServlet")
- public class FirstServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
- /**
- * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
- */
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
- //response.getWriter().append("Served at: ").append(request.getContextPath());
- //My Code
- response.setContentType("text/html");
- PrintWriter pw = response.getWriter();
- String name1 = request.getParameter("fname");
- String name2 = request.getParameter("lname");
- pw.println("Welcome " + name1 +" " + name2);
- pw.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement