Monday, April 30, 2012

Struts 2 List of List access

I wonder if someone can help.



Background Architecture:



I have an application which contians many areas which have many specific questions, where these questions contian progress



So at a high-level view there can be many applications. A user is associated to maybe many applications.



So I have a list of applications and I can quite easliy iterate my way through and get its relevant details. But when it comes to accessing each specific area to get question progress for some reason it does not work out form me.



So here is logic I want:




for the applications




display its details




for each area(applicaitonId)




display each its completion progress







so to translate to struts I have this



<s:iterator id="app" value="appList" status="row">
<s:iterator id="qsp" value="questionProgessList[%{#row.index}]" status="status">


so applist is the list of all applications with its own getter/setter && questionSetProgress is defined by:



List<ApplicationQuestionSetProgress> getQuestionProgressList(final int index)


or
List> getQuestionProgressList()



So trying in many ways to access the list has proved futile I have tried:



<s:iterator id="qsp" value="questionProgessList">
<s:property />
</s:iterator>


with this:



List<List<ApplicationQuestionSetProgress>> getQuestionProgressList()


but no joy



I've also tried using the iterator index to call the method but it just does not work out.



List<ApplicationQuestionSetProgress> getQuestionProgressList(final int index)


i.e.



<s:iterator id="qsp" value="questionProgessList[%{#row.index}]" status="status"> or <s:iterator id="qsp" value="questionProgessList(%{#row.index})" status="status">



any hints or tips??



TIA





No comments:

Post a Comment