2010-02-13 58 views
0

我有一個使用for:each循環顯示數據的JSP。在這個循環中,我有一個多框標記,它將在每個對應行旁邊顯示覆選框。用戶將能夠選擇全部或幾個或不選中複選框並單擊打印。關於<html:multibox>的問題?

JSP PAGE LOOK :-- 

MULTIBOX PERSONNAME INVITATIONLIST 
------------- ------------------ --------------------- 
PROPERTY:-- [STRINGARRAY] [STRING] [STRINGARRAY] 

<table><tr> 
<logic:iterate id="message" name="MessageForm" property="nameList"> 

<td> 
<html:multibox name="FORM" property="GETINVITATIONS"> 
<bean:write name="FORM" property="name" /> 
<bean:write name="FORM" property="selectedInv" /> <------ how to add String array to 'GETINVITATIONS'? 
</html:multibox> 
</td> 

<td><bean:write name="FORM" property="name" /></td> [NAME] 
<td> 

<bean:define id="List" name="FORM" property="invLst" type="java.util.ArrayList" /> 
<html:select style="width:200px;" name="FORM" property="selectedInv" styleId="selectedInv1" multiple="true"> [MULTIPLE INVITATION NAMES] 
<html:options name="List"/> 
</html:select> 

</td> 
</logic:iterate> 
</tr> 
</table> 

只有名稱被添加到GETINVITATIONS; selectedInv未添加到它。只能在控制檯中命名打印。怎麼做?

+0

我假設selectedInv是String [],是否正確? –

回答

0

你爲什麼不試試這個?

<td> 
<html:multibox name="FORM" property="GETINVITATIONS"> 
<bean:write name="FORM" property="name" /> 
<logic:iterate id="inv" name="FORM" property="selectedInv"> 
    <bean:write name="inv" />&nbsp; 
</logic:iterate> 
</html:multibox> 
</td> 

基本上,你通過所述selectedInv字段迭代(其是字符串的數組),並將其寫入到JSP(使用豆:寫入)。