Help coderanch get a
new server
by contributing to the fundraiser
  • 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

how to populate a bean in a form?

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I would like to populate an object's (bean) info into my form.

can anyone assist what the code should be look like???

I have this:



the bean is in this format:
<bean:write name="empl" property="name" />

thanks

PS:
I know I can simply populate the form from the action prior to this page, but this isn't the case since the page is a composition of couple of pages.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

value= "what should be written here???"



Answer: nothing

You shouldn't code a value attribute at all. The <html:text> tag automatically uses the value of the actionform property you specify.

I know I can simply populate the form from the action prior to this page, but this isn't the case since the page is a composition of couple of pages.


Whether the page is a composition of pages is irrelevant. The correct place to set the ActionForm property is in an Action class that forwards to this JSP. If this page is part of a tiles definition, that's fine. You can still populate the ActionForm prior to the page being displayed.
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well the problem occurred when I placed the fw in a composition page:

original (worked OK)


the fw I replaced was this


and it doesn't work. I assumed it's because of the page composition.
any idea?
 
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic