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?
Any and all help would be appreciated.
Thanks,
Kevin
____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets