Re: Handling DataObjects

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Sep 14 2004 - 18:05:59 EDT

  • Next message: Andrus Adamchik: "[OT, Mac OS X] CayenneModeler and Java 1.4.2_05 upgrade"

    I guess in this case using PK is ok, as we are talking about a table
    with only a few available choices, so "hacking" a PK by a malicious
    user can't go too far.

    In general I would prefer a solution similar to WOPopUpButton in
    WebObjects that automatically generates the values for select options,
    and internally maps them to the list objects (e.g. using index of an
    object in the list as "value"). This way it is unhackable, as there is
    no way to specify a value outside the valid range. I am sure a similar
    solution can be done as a JSP custom tag (and I am sure that someone
    has done this already?)... But then again - in your case it probably
    doesn't matter either way.

    Andrus

    On Sep 13, 2004, at 6:12 PM, Joćo Paulo Vasconcellos wrote:
    > I am using this code right now to do this:
    >
    > ------------------
    >
    > <%
    > for(int i = 0, total = listaEstadoCivil.size(); i < total; i++) {
    > %>
    > <option
    > value="<%=DataObjectUtils.intPKForObject((EstadoCivil)listaEstadoCivil.
    > get(i))%>">
    > <%=((EstadoCivil)listaEstadoCivil.get(i)).getNome()%></option>
    > <%
    > }
    > %>
    >
    > ------------------
    >
    > On Mon, 13 Sep 2004 19:01:33 -0300, Joćo Paulo Vasconcellos
    > <vasconcello..mail.com> wrote:
    >> Hello list, let's see if I can make a real question this time. :)
    >>
    >> I am writing an application which lets people changes their data. I
    >> got a field named Marital Status and I need to show a list of the
    >> possible status. All fine until there. The problem is, how do I
    >> retrieve this info from the form? When the user changes their marital
    >> status using the <select> provided, how can I know which status she
    >> picked up whithout using the object's PK, as this is bad design?
    >>
    >> Just a bit lost in this.
    >>
    >> TIA,
    >> --
    >> Joćo Paulo Vasconcellos
    >> ICQ: 123-953-864



    This archive was generated by hypermail 2.0.0 : Tue Sep 14 2004 - 18:06:05 EDT