Ex:7
INDEX.JSP:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
QUESTIONS:
1.JavaUses:
Interpreter
Compiler
Interpreter&Compiler
2.Net is an OS:
yes
no
3.ASP Uses:
VBScript
JavaScript
VBScript&JavaScript
SERV.JAVA:
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;
@WebServlet(name = "serv", urlPatterns = {"/serv"})
public class serv extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String ans1=request.getParameter("ans1").toString();
String ans2=request.getParameter("ans2").toString();
String ans3=request.getParameter("ans3").toString();
out.println("");
out.println("");
out.println("
out.println("
");out.println("");
out.println("Answer for 1st="+ans1+"
");
out.println("Answer for 2nd="+ans2+"
");
out.println("Answer for 3rd="+ans3+"
");
out.println("
");out.println("
");} finally {
out.close();
}
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int s=0;
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String res=request.getParameter("ans1");
if(res.equals("intercomp"))
s=s+5;
res=request.getParameter("ans2");
if(res.equals("no"))
s=s+5;
res=request.getParameter("ans3");
if(res.equals("vbjs"))
s=s+5;
out.println("
RESULT
"+s+"
Thanx
for ur Participation
");out.close();
}
}
No comments:
Post a Comment