1)Write a Servlet that accepts a String from the user and display the string as a marquee in response.
Marquee.html
1 2 3 4 5 6 7 8 9 10 11 12 13 | <html> <head> <title>marquee</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <form name="frm" method="get" action="marquee"> Enter name: <input type="text" name="txt"><br> <input type="submit" value="Display"> </form> </body> </html> |
Marquee.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class marquee extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); response.setContentType("Text/html"); String user=request.getParameter("txt"); out.println("<marquee>" + user + "</marquee>"); } }
|
No comments:
Post a Comment