954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

jsp program not giving desired output


<%
String ans=" ";
if(request.getParameter("correctAns")!=null)
{
ans=request.getParameter("correctAns").toString();
}


Connection con = null;

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = java.sql.DriverManager.getConnection("jdbc:odbc:sid");
Statement st = null;
ResultSet qrst;
ResultSet rs = null;

String id=request.getParameter("id");
System.out.println("id:"+id);

int i=1;

String s,g;

int count=0;

try {

st = con.createStatement();
//for(i=1;i<=2;i++)
// {
rs = st.executeQuery("select * from quiz");

while(rs.next()) {
%>



Online Quize Application

Select Correct Answer
Question:
<%= rs.getString("quest") %>

1:
<%= rs.getString("QA") %>
2:
<%= rs.getString("QB") %>
3:
<%= rs.getString("QC") %>
4:
<%= rs.getString("QD") %>




biplob29
Newbie Poster
1 post since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

Sorry, but I, for one, am not going to even try to decipher these scriptlets. You should not be using scriptlets, that is the technology from over a decade ago. Go through the JEE6 tutorials and learn to do this right.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: