dynamic category and question

now i have chalenge for create dynamic category and question

Screenshot_2

 

String totalCat = (String) request.getAttribute("totalcat");
Integer totalCategory = Integer.parseInt(totalCat);

System.out.println("total category:" + totalCategory);

for (int countCat = 0; countCat < totalCategory; countCat++) {
  String Category = (String) request.getAttribute("category" + countCat);
  System.out.println("categoryid:" + Category);
  String totalQuestion = (String) request.getAttribute("totalquest" + Category);
  System.out.println("totalQuestion:" + totalQuestion);
  Integer totalQuestions = Integer.parseInt(totalQuestion);

// System.out.println(totalQuestions);

for (int countQuest = 0; countQuest < totalQuestions; countQuest++) {
 questId = (String) request.getAttribute("cat" + Category + "quest" + countQuest);
 answerText = (String) request.getAttribute("answertext" + questId);
 }
 }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s