• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dynamically create fields based on bean

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Address bean and I want to create the fields based on this
Address getters/setters for below fields

street
city
state
zip
country

here is my form declaration.

<form-property name="address" type="com.mycompany.Address"/>

How to use this info to create my fields in my jsp page dynamically?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you just want to display the fields, use the "dot" notation to do so. Example:

If you're looking for a way to automatically figure out what properties the bean has and display them all, there's no facility in Struts to do that. It could be done, but you'd have to do most of the coding yourself. You may want to check out what utilities are available in the Apache Commons BeanUtils project.
[ March 22, 2007: Message edited by: Merrill Higginson ]
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic