I am doing a project in jsp of creating question paper from question bank.
Here we have to generate a paper based on the language like c,c++.
we want to know how to generate the paper by considering two question from each area like inheritence,exception handling.the question has to be randomly gnererated from question bank database which has area_id and language_id and questions. Kindly give us a logic how to select questions accordingly.
we tried the following logic but it does not work.WE are working in net beans(derby server).
ResultSet rs = st.executeQuery("select tech,t.tid,a.tid,aid from technology t,area a where t.tid=a.tid ");
while(rs.next())
{
if(option.equals(rs.getString(1)))
{
tid = rs.getString(2);
if(tid.equals(rs.getString(3)))
{
aid = rs.getString(4);
%>
<p><%=aid%></p>
<%
ResultSet rp=st.executeQuery("select * from qp order by random() ");
while(rp.next()){
while(rp.getString(3).equals(rs.getString(4))){
%> <p><%=rp.getString(4)%></p><%
}
}
}
}}
Here we first selected the desired language(technology) and in each technlogy we have different areas.We selected the areas and put them in an array and from each array element we tried to select questions under each element to apply random number generation function to select question but it does not work.