Hi all,
I am new to
jsp. I have designed one program in jsp that it contains 5 questions. i did it using if loop. if i use jsp forward page, instead of displaying fifth question, it displays the forwarded page.
"quiz.jsp" is my page and if the last question comes, it has to go to the "handle.jsp" page. but i am not getting the last question. it displays the 4 th question and then to "handle.jsp"
here is my code..
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%!
int count=1;
Connection con=null;
Statement stmt=null;
ResultSet res=null;
%>
<html>
<body>
<form action="quiz.jsp">
<%
Object o=request.getAttribute("modern");
try
{
boolean ab=false;
if(count<=5)
{
class.forName();
...
...
<% if(count<5)
{
%>
<input type="submit" value="next">
<% } %>
<% if(count==5)
{
%>
<input type="submit" value="Submit">
<% ab=true;
} %>
<br></br>
<%
count++;
}
if(ab==true)
{
%>
<jsp:forward page="handle.jsp"/>
<% }
}
catch(Exception e)
{
System.out.println("Exception"+e);
}
%>
</form>
</body>
</html>