• 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

Simple Question

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to get values into my bean?
Thank you in advance
Steve
Action Form

Bean

struts-config.xml

[ June 29, 2005: Message edited by: Steve Li ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Define a loading Action that is assigned to MyForm and forwards to the JSP. In the execute() method of the action, insert code that will populate the bean.

For example:

MyForm myForm = (MyForm) form;
myform.setMyObj(new MyObj[3]);
myform.setMyObj(0, new MyObj(1, new Date()));
myform.setMyObj(1, new MyObj(55, new Date()));
myform.setMyObj(2, new MyObj(100, new Date()));


return mapping.findForward("MyForm");



Once you do this, the form bean will have the necessary information to display in the form.
 
Steve Li
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much for your reply, but I want to capture user input and populate "private MyObj []myObject" of action in order to save user input in DB.
Question: What should be the value of "name" and "property" in JSP for "html:text" tag.
Thank you in advance
Steve

struts-config.xml




JSP Code


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

Try this :


[ June 30, 2005: Message edited by: cendy nguvy ]
 
Steve Li
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply, but I am looping over a different collection which has different objects in it.But I want the user input to populate
"MyObj []myObject" where MyObj has a number and a date.

JSP Code:


Thank you in advance
Steve
 
Steve Li
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since, I am going over a collection to output the description of doc.And I want to get user input to save it in database.
Question: How to get user input, ie how to pupolate

The JSP is


Thank you in advance
Steve
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic