I am trying to use Struts for an account creation application


  1. In my JSP page I am using a List (named results) to get account
  information (name, id and more.. )
  2. The list stores this information in an AccountInfo bean and I am
  using a for loop to go through the List.
  3. I am using a Map to pass values to the next Action and I was
  wondering if I can use the AccountInfo Bean instead since it has all the
  information?
  4. I am not using a use:bean tag and just creating it as seen below
  (AccountInfo ai = (AccountInfo) results.get(count);)



             <%
               for (int count = 0; count < results.size; count++) {
               AccountInfo ai = (AccountInfo) results.get(count);
             %>

            <tr>
               <td><%=ai.getLname()%>, <%=ai.getFname()%> </td>
               <td><%=ai.getUsername()%></td>
               <td><%=ai.getId()%></td>


             <%java.util.HashMap map =new java.util.HashMap();
               map.put("firstName", String.valueOf(ai.getFname()));
               map.put("lastName", String.valueOf(ai.getLname()));
               map.put("userName", String.valueOf(ai.getUsername()));
               pageContext.setAttribute("map",map);%>

               <td width="3%">
               <html:link page="/showCreate.do" name="map"><img
src="images/acct.jpg" width="16" height="20" border="0" title="Create
Account"></html:link>
               </td>
            </tr>

             <%}%>

Any suggestions?
Priya

Reply via email to