This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Simple Question

 
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 ]
 
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


 
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
 
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic