Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple Question

 
Steve Li
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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 ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • 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
  • 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


 
Cendy Nguvy
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic