Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • accessing variables using logic:iterate

    5 answers - 773 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi,
    Currently I have a action class which does
    session.setAttribute("recurringTaskSummary",v_recurringTaskSummary),
    where v_recurringTaskSummary is a vector of type
    SpRecurringTaskSummary which has certain variables such as
    EmployeeName, EmployeeRef etc.
    I am using logic:iterate as follows:
    <logic:iterate id = "rtSummary" name="recurringTaskSummary">
    <bean:write name="rtSummary"/>
    </logic:iterate>
    The output is name of objects. However I want to somehow access the
    variables employeename, employeeref etc. How do I do that ?
    Thanks,
    Jay
    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.1 | | 1150 bytes | |

    S Zuckerman wrote:

    >I am using logic:iterate as follows:
    ><logic:iterate id = "rtSummary" name="recurringTaskSummary">
    ><bean:write name="rtSummary"/>
    ></logic:iterate>
    >>

    >The output is name of objects. However I want to somehow access the
    >variables employeename, employeeref etc. How do I do that ?
    >

    <logic:iterate id="rtSummary" name="recurringTaskSummary">
    <bean:write name="rtSummary" property="employeeName"/>
    </logic:iterate>

    Don't forget to use the bean naming conventions, though.

    As a followup, you may want to consider switching to JSTL for
    straight-forward tasks such as this: where functionality is duplicated
    between the Struts tags and JSTL it's generally recommended to go the
    JSTL route. It's a trivial switch to make, and can be done mechanically
    in most cases.

    Dave

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.2 | | 1338 bytes | |

    HI,
    When i do :
    <logic:iterate id="rtSummary" name="recurringTaskSummary">
    <bean:write name="rtSummary" property="employeeName"/>
    </logic:iterate>

    it says not getter for employeeName in bean rtsummary.
    'recurringTaskSummary' is a vector and not a bean.
    I tried using the attribute type="SpRecurringTaskSummary" but got the
    same error.

    I think I am missing the big picture or something basic in logic:iterate.

    Thanks,

    Jay

    8/16/05, S Zuckerman <stephane.zuckerman (AT) gmail (DOT) comwrote:
    Hi Jay,
    session.setAttribute("recurringTaskSummary",v_recurringTaskSummary),

    SpRecurringTaskSummary [] has certain variables such as
    EmployeeName, EmployeeRef etc.

    I am using logic:iterate as follows:
    <logic:iterate id = "rtSummary" name="recurringTaskSummary">
    <bean:write name="rtSummary"/>
    </logic:iterate>

    The output is name of objects. However I want to somehow access the
    variables employeename, employeeref etc. How do I do that ?

    Just do something like :

    <logic:iterate id="rtSummary" name="recurringTaskSummary">
    <bean:write name="rtSummary" property="employeeName"/>
    </logic:iterate>

    Don't forget to use the bean naming conventions, though.
  • No.3 | | 986 bytes | |

    Jay Sheth wrote:

    >HI,
    >When i do :
    ><logic:iterate id="rtSummary" name="recurringTaskSummary">

    <bean:write name="rtSummary" property="employeeName"/>
    ></logic:iterate>
    >
    >it says not getter for employeeName in bean rtsummary.
    >'recurringTaskSummary' is a vector and not a bean.
    >I tried using the attribute type="SpRecurringTaskSummary" but got the
    >same error.
    >
    >I think I am missing the big picture or something basic in logic:iterate.


    (1) The 'type' attribute expects a full classname, but that's probably
    not relevant here.
    (2) What he was saying was that the Vector's objects must follow
    JavaBean naming conventions.

    Dave

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.4 | | 1384 bytes | |

    Thanks a lot. Got it. As you said, the naming conventions were
    followed, but I made a typo in the property attribute.

    Sorry for the trouble.

    Jay

    8/16/05, Dave Newton <newton (AT) pingsite (DOT) comwrote:
    Jay Sheth wrote:

    >HI,
    >When i do :
    ><logic:iterate id="rtSummary" name="recurringTaskSummary">

    <bean:write name="rtSummary" property="employeeName"/>
    ></logic:iterate>
    >
    >it says not getter for employeeName in bean rtsummary.
    >'recurringTaskSummary' is a vector and not a bean.
    >I tried using the attribute type="SpRecurringTaskSummary" but got the
    >same error.
    >
    >I think I am missing the big picture or something basic in logic:iterate
    >
    >

    (1) The 'type' attribute expects a full classname, but that's probably
    not relevant here.
    (2) What he was saying was that the Vector's objects must follow
    JavaBean naming conventions.

    Dave

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.5 | | 521 bytes | |

    S Zuckerman wrote:

    What I really dislike with struts tags is that attributes don't always
    mean the same thing from tag to tag, which is disturbing. I'm mainly
    thinking of the "name" and "property", and ".*Name" attributes too.

    Ah, I'm glad to hear I'm not the only one that is wogged by this.

    *sigh*

    Dave

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org

Re: accessing variables using logic:iterate


max 4000 letters.
Your nickname that display:
In order to stop the spam: 2 + 1 =
QUESTION ON "Java"

EMSDN.COM