Posted By:
Adam_Seymour
Posted On:
Thursday, June 5, 2003 10:42 AM
I am currently developing a questionnaire jsp. The layout of the page is simply a list of questions with their input fields (mostly checkboxes and radio buttons) below each question. There are 3 methods on the EJB: The first (getQuestions) returns a map with questionID as its key, and the String question itself as the value. The second (getQuestionType) returns a String (either checkbox, radio, text, etc) when the questionID is passed in as the argument. (This questionType is stored in a hidden field on the jsp, and a simple java 'if/else' to do the correct HTML) The third (getOptions) return a String[] of the options for the particular questionID passed in as the argument.
More>>
I am currently developing a questionnaire jsp. The layout of the page is simply a list of questions with their input fields (mostly checkboxes and radio buttons) below each question.
There are 3 methods on the EJB:
The first (getQuestions) returns a map with questionID as its key, and the String question itself as the value.
The second (getQuestionType) returns a String (either checkbox, radio, text, etc) when the questionID is passed in as the argument.
(This questionType is stored in a hidden field on the jsp, and a simple java 'if/else' to do the correct HTML)
The third (getOptions) return a String[] of the options for the particular questionID passed in as the argument.
Unfortunately the number of questions returned by the EJB are totally variable - there is currently no set limit to questions, nor the number of options they have.
I've tried a number of combinations of logic, bean and nested tags to get the questions displayed with their relevant options, but the problem seems to be that struts requires a specific getter/setter for each individual string to be displayed on the page (be it question or question option). As the size of the map and array brought back from the ejb are undefined, I see no way of doing this.
Does anyone have a similar problem/know of a way around this?
All I can think of is to limit the number of questions returned by the ejb so I can write individual getter/setter method for each string.
<<Less