Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > useBean in JSP for bean within a bean

Reply
Thread Tools

useBean in JSP for bean within a bean

 
 
kumar
Guest
Posts: n/a
 
      02-13-2004
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
 
Reply With Quote
 
 
 
 
Wendy S
Guest
Posts: n/a
 
      02-13-2004
"kumar" <(E-Mail Removed)> 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:
<cut value="${customer.billingAddress.city}"/>
(or just the expression, if you're on Servlet 2.4).

--
Wendy in Chandler, AZ





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP newbie - <jsp:useBean > question zalek Java 1 08-23-2008 07:19 PM
dynamic attribute within JSP-tag (useBean) iliad Java 0 09-09-2005 01:38 PM
JSP <jsp:useBean ... /> tag: Difference between 'class' and 'type' Sean Aitken Java 3 10-21-2004 11:35 AM
Difference between <jsp:useBean> and <bean:define> ? Anan H. Samiti Java 1 09-27-2004 01:09 PM
JSTL & jsp:useBean life cycle? P.Hill Java 4 02-05-2004 06:31 PM



Advertisments