useBean in JSP for bean within a bean

Discussion in 'Java' started by kumar, Feb 13, 2004.

  1. kumar

    kumar Guest

    I have a 'CustomerForm' bean that has an 'Address' bean that has a
    property 'city'.

    My Code:
    <jsp:useBean id="customerForm" scope="session"
    class="com.abc.forms.CustomerForm" />
    <jsp:getProperty name="customerForm" property="billingAddress.city" />

    CustomerForm does have getter/ setter for Address object and so does
    Address for city field. I do know of tag in struts like

    <html:text name="customerForm" property="billingAddress.city"
    maxlength='40' size="40"/>

    that woudl serve the purpose. but it has limitations. The limitation
    being, I cannot access the text box element within javascript with its
    name translating to 'billingAddress.city'.

    Can any one provide me with a solution for the above scenario?

    Appreciate our help.
    Thanx
     
    kumar, Feb 13, 2004
    #1
    1. Advertising

  2. kumar

    Wendy S Guest

    "kumar" <> wrote:
    > <html:text name="customerForm" property="billingAddress.city"
    > maxlength='40' size="40"/>
    >
    > that woudl serve the purpose. but it has limitations. The limitation
    > being, I cannot access the text box element within javascript with its
    > name translating to 'billingAddress.city'.


    By the time the JavaScript runs (on the client side), that Struts tag will
    have been transformed into a plain old HTML <input type="text" ...> tag.
    JavaScript is never going to see 'billingAddress.city'.

    Another option would be JSTL:
    <c:eek:ut value="${customer.billingAddress.city}"/>
    (or just the expression, if you're on Servlet 2.4).

    --
    Wendy in Chandler, AZ
     
    Wendy S, Feb 13, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. P.Hill
    Replies:
    4
    Views:
    9,419
    Chris Riesbeck
    Feb 5, 2004
  2. Sean Aitken
    Replies:
    3
    Views:
    11,188
    Alex Hunsley
    Oct 21, 2004
  3. Anan H. Samiti
    Replies:
    1
    Views:
    7,740
    kaeli
    Sep 27, 2004
  4. iliad
    Replies:
    0
    Views:
    2,297
    iliad
    Sep 9, 2005
  5. zalek
    Replies:
    1
    Views:
    388
Loading...

Share This Page