accessing an array in a bean using servlets and jsp
i'm tryin g to set the values of a string array in a bean using a servlet and then get them from a jsp. But only null is returned. is this because the values are not prpperly set or is something wrong with th scriplet in the jsp file. any help is most appreciated. thankx
the bean, servlet and the jsp files ae given below.
//User.java
package beans;
publicclass User
{
privateint No_Of_Questions = 30;
private String name;
privateint result;
private String [] question =new String [No_Of_Questions];
private String [] answer =new String [No_Of_Questions*4];
public User(){}
publicvoid setName(String str){name = str;}
public String getName(){return name;}
publicvoid setResult(int marks){result = marks;}
publicint getResult(){return result;}
publicvoid setQuestion(String [] ques){question = ques;}
public String [] getQuestion(){return question;}
publicvoid setAnswer(String [] anws){answer = anws;}
}
//************************8jsp file
<%-- test.jsp --%>
<html>
<head><title>StudentRegistration Front</title></head>
<jsp:useBean id="user" class="beans.User" scope="session" />
<body>
<font color="blue">
<h2 align="center">
Welcome <jsp:getProperty name="user" property="name" />:
</h2>
</font>
<%
//String name = user.getName();
String [] question = user.getQuestion();
String [] answer = user.getAnswer();
out.println(question[1]);
%>
<form action="marking.jsp" method="post">
<h4 align="center">
<input type="submit" value="submit">
</h4>
</form>
</font>
</body>
</html>
//***************************servlet
ResultSet questionSet = statement.executeQuery("SELECT QUESTION FROM QUESTION");
ResultSet answerSet = statement.executeQuery("SELECT ANSWER FROM ANSWER");
while(questionSet.next())
{
for(int i = 1; i<=noOfQuestions; i++)
question[i] = questionSet.getString(i);
}
while(answerSet.next())
{
for(int j = 1; j<=noOfAnswers; j++)
answer[j] = answerSet.getString(j);
}
user.setQuestion(question);
user.setAnswer(answer);
when the webapp is run using tomcat, null is printed. plz help

