tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From greyson.sm...@convergys.com
Subject Was there an answer to this? (setProperty and repeating form fields)
Date Tue, 29 May 2001 17:52:35 GMT
I find myself in a situation similar to this, and I wondered if there was
ever an answer to the question.



In order to set my bean properties based on an incoming (POST'ed) HTML
form,
I'm using the following construct in a JSP page:

<jsp:useBean id="ord" class="ord.OrderBean" scope="request">
  <jsp:setProperty name="ord" property="*"/>
</jsp:useBean>

It works fine except now I want to process something a little different.
I'm
working on an Order entry system and the Order Items are a repeating group
of
fields.  In my HTML form I have <input> fields named like "partNumber0,
quantity0, price0" and "partNumber1, quantity1, price1" that repeat for
each
potential item in an order.

Is there any way to use the <jsp:setProperty> construct to automatically
set
the properties in an OrderItems bean.  I'm guessing it might have something
to
do with indexed properties but I really can't see how this would work.  If
I
have my bean as

public class OrderItemBean
{
   String[] partNumber;
   ...

   public void setPartNumber( int index, String value ) {...}
   ...
}

Is the JSP runtime going to be able to take the partNumber0 field and be
able
to call my indexed-property setter method with the correct index.  What if
I
use the version

   public void setPartNumber( String[] value );

as my setter method?

--

NOTICE:  The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential.  If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected.



Mime
View raw message