I am writing a survey-type application.

I have a single ActionBean that is responsible for showing survey questions,
whether those questions have many multiple choice answers, or many
non-mutually-exclusive answers (checkboxes).

When you submit a response in this application, it gets processed by an
ActionBean that records your potentially *many* responses (the recording
bean, in other words, doesn't know whether the question had many possible
answers, or a single possible answer).

So my RecordResponseActionBean has a List<QuestionResponse> property called
responses.

Now in the JSP, it's easy even when I'm working with radio buttons (single
answers) to have Stripes automatically figure out that it's dealing with a
list and to do the right thing.  That is, I have:

<stripes:radio name="responses" value="string that gets passed to a
QuestionResponse constructor" .../>

So the fact that the radio *scalar* value is getting added to a List on the
ActionBean is transparent, and very useful.

But now I want to use the most recent *response* when I'm showing the
question--that is, I want to serve up the most recent response in a way that
Stripes can use to populate the state of the radio button.

Normally, of course, a radio button expects a scalar value to be supplied,
and normally the ActionBean handling the form submission would store a radio
button's value as a scalar.  As I've just shown above, in my case I'm
storing them as a list.  Consequently I'm not seeing an easy way to indicate
which of my radio buttons should be checked by default.  Is there some magic
I can sprinkle on the stripes:radio tag to help me out here?

Thanks,
Laird
-- 
View this message in context: 
http://www.nabble.com/stripes%3Aradio-and-Lists-tp21334567p21334567.html
Sent from the stripes-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to