(Solved):Given the XHTML page Main.html, write the corresponding JSP page that displays congratulation message if grade 60 and sorry message if grade 60 and error message of grade 100 as the following… View Answer…

 

Question

Given the XHTML page Main.html, write the corresponding JSP page that displays congratulation message if grade > 60 and sorry message if grade < 60 and error message of grade > 100 as the following:

Main.html

<!DOCTYPE html>

<html>

<body>

<h2>Enter Your Information</h2>

<form action=”main.jsp”>

Full name:

<input type=”text” name=”fullname”>

Mark:

<input type=”text” name=”mark”>

<input type=”submit” value=”Submit”>

</form>

</body>

</html>

 

EXPERT ANSWER

main.jsp:

<%
int value=Integer.valueOf(request.getParameter("mark"));
if (value < 60)
{
%>
Sorry
<%
}
else if (value > 100)
{
%>
Error
<%
}
else
{
%>
Congratulations
<%
}
%>

The original XHTML gives us a few clues:

Scroll to top