facebook

problem with struts iterator tag-Help!

  1. MyEclipse Archived
  2.  > 
  3. General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #237033 Reply

    jcasual
    Member

    I am new to struts(and somewhat new to Java).
    I am trying to extract my data out of a string array onto
    a JSP confirmation page.
    😕 Can someone tell me how to get the correct results(values) from my collection?

    I have copied the relevant code:

    CaseService Module:

    String writeOff=null;
    String osi=null;
    String taxReporting=null;
    
    if (rs.getInt("writeOff")==1){writeOff="writeOff";}
    if (rs.getInt("osi")==1){osi="osi";}
    if (rs.getInt("taxReporting")==1)
    {taxReporting="taxReporting";}
    
    String[] selectedStatusValues={writeOff,osi,taxReporting};
    dto.setSelectedStatus(selectedStatusValues);

    caseRecordAction(Dispatch Action) :

    dto.getSelectedStatus();
    request.setAttribute("selectedStatus",selections);
    
    return mapping.findForward("showDeleteConfirm");

    JSP:
    Case Events

    <logic:iterate id="items" name="selectedStatus">
    <bean:write name="selectedStatus"/>
    
    </logic:iterate>

    Page Results:

    Case Events

    [Ljava.lang.String;@1c948cb
    [Ljava.lang.String;@1c948cb
    [Ljava.lang.String;@1c948cb

    if I try the following I get an error that can’t find
    bean “items”:

    Case Events

    <logic:iterate id="items" name="selectedStatus">
    <bean:write name="items"/>
    </logic:iterate>
    #237042 Reply

    Riyad Kalla
    Member

    if I try the following I get an error that can’t find
    bean “items”:

    This second snippet of code is actually the correct way, have you tried usign collection attribute instead of selectedStatus?

    #237066 Reply

    jcasual
    Member

    I’m not sure I undstand your question. but I used the same property(selectedStatus) for a multibox control on my form. It works just fine. Since multibox can only accept a String array I thought the iterator would work for selectedStatus on the delete confirmation form. Is this not the case? I welcome any alternative solutions. Thanks for your responses.

    #237082 Reply

    Riyad Kalla
    Member

    Try asking the Struts mailing list, I’m really rusty on my Struts right now and I know the specifics ofthe tags can be tricky to remember how they need to be configured.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: problem with struts iterator tag-Help!

You must be logged in to post in the forum log in