Hi, I'm working with an application where i should convert the code that written using <logic:iterate> (i.e struts 1.2) with <s:iterator tag> (struts 2.1). Below i show the struts1.2 code and also the code which i replaced with <s:iterator> tag
Old code: //Sub Menu for 2nd Main Menu Item ("Admin"): menus[1] = new menu(180, "vertical", 0, 0, -1, -1, "", "#ce122d", "Verdana,Helvetica", 8, "normal", "normal", "white", "#fcccb5", 1, "#ce122d", 2, 62, false, true, false, false, 0, true, 4, 4, "black"); <% int adminIndex = 0; %> <logic:iterate indexId="idx" id="nfpaTable" name="NfpaTables" scope="session"> <% adminIndex = idx.intValue() + 3; %> menus[1].addItem("#", "", 20, "left", "<bean:write name="nfpaTable" property="tableName"/>", <%=adminIndex%>); </logic:iterate> <% adminIndex++; %> menus[1].addItem("#", "", 20, "left", "Status", <%=adminIndex%>); <% adminIndex++; %> menus[1].addItem("#", "", 20, "left", "Compliance Statement", <%=adminIndex%>); <% adminIndex++; %> menus[1].addItem("#", "", 20, "left", "Reference Document", <%=adminIndex%>); My new code was written using struts2 as shown below: //Sub Menu for 2nd Main Menu Item ("Admin"): menus[1] = new menu(180, "vertical", 0, 0, -1, -1, "", "#ce122d", "Verdana,Helvetica", 8, "normal", "normal", "white", "#fcccb5", 1, "#ce122d", 2, 62, false, true, false, false, 0, true, 4, 4, "black"); <% int adminIndex = 0; %> <s:iterator value="%{#session.NfpaTables}" status="idx" id="nfpaTable" > <% adminIndex = "%{#idx.index}" + 3; %> menus[1].addItem("#", "", 20, "left", "<s:property value="#nfpaTable.tableName" />", <%=adminIndex%>); </s:iterator> <% adminIndex++; %> menus[1].addItem("#", "", 20, "left", "Status", <%=adminIndex%>); <% adminIndex++; %> menus[1].addItem("#", "", 20, "left", "Compliance Statement", <%=adminIndex%>); <% adminIndex++; %> menus[1].addItem("#", "", 20, "left", "Reference Document", <%=adminIndex%>); When i run the application, the eclipse shows the error as......... An error occurred at line: 25 in the jsp file: /includes/header_nfpa.jsp Type mismatch: cannot convert from String to int 22: <% int adminIndex = 0; %> 23: <s:iterator value="%{#session.NfpaTables}" status="idx" id="nfpaTable" > 24: 25: <% adminIndex = "%{#idx.index}" + 3; %> 26: menus[1].addItem("#", "", 20, "left", "<s:property value="#nfpaTable.tableName" />", <%=adminIndex%>); 27: </s:iterator> 28: <% adminIndex++; %> So, pls Help me out in this issue.