I have implemented online question/poll systems many times. Relational databases may be great for some things but they are a horrible way to store and access question data. (IM-not so-HO) Why? Because they are so inflexible - XML works well for flexible creation of questions.
You can also include the XML data in your database. You'd normally have to write a parser to deal with the XML, but for some time I've been working with
Java's XML serialisation and it works really well and is very straightforward to start using... all you need to do is:
(1) Create a bean class (say PollBean) to store your poll data in. For example, containing the fields "question" (
String), "answers" (String[]).
(2) Use java.beans.XMLEncoder to serialise a PollBean instance containing all the required data into XML. The instance can be obtained by completing an admin form or from some other console (or indeed written by hand once you see the format).
(3) Use java.beans.XMLDecoder to deserialise the object from the file/database when you're ready to read its contents (e.g. on each loading of the page). This will automatically extract all the data from your XML source into a new bean, which will then 'look like' the original bean.
Now you have a PollBean instance in the JSP, so you can easily use EL to manipulate your bean. For example, to write out all the answers just use the JSTL <c:forEach> on its "answers" property.
One final comment: you have incorrectly implemented this bit:
This will not work because "count" here is a JSP scripting variable and not a
scoped attribute. It is therefore not accessible from your EL code. You would therefore instead want to set the page-scoped attribute through the pageContext, or alternatively use <c:set> like:
Better still, you needn't do any of that, you can simply use the "varStatus" attribute of <c:forEach>:
Note that "status.count" is 1-based, so you don't need to initialise any variables, and you don't need to use scripting elements.