Q1:You are required to write the code for sevlet which will takeusername and pas
ID: 3612334 • Letter: Q
Question
Q1:You are required to write the code for sevlet which will takeusername and password from the html file and matches with databasewhich contains two columns; one for username and other forpassword.
Providing correct information leads to welcome page otherwise toa login page again.
You are required to write the code for servlet only.
Q2:
You are required to write the XML equivalent tags for thefollowing elements of JSP (Java Server Page).
1)
<%!
String str ;
public StringconcatenateStr(String s1, String s2){
return s1+s2 ;
}
%>
2)
<%
String s1=request.getParameter(“str1”);
String s2=request.getParameter(“str2”);
str = concatenateStr(s1, s2);
%>
3) <%@page import =“java.util.*” %>
Explanation / Answer
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;
import javax.servlet.http.HttpSession;
public class LoginHandler extends HttpServlet
{
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.