[program-java] Java: Form Bean

  • From: "Corbett, James" <James.Corbett@xxxxxxxxxxxxx>
  • To: "'program-java@xxxxxxxxxxxxx'" <program-java@xxxxxxxxxxxxx>
  • Date: Wed, 2 Feb 2011 13:46:58 -0500

Hello:

I have a STRUTS app that has an intro.jsp page. Said page has a number of links 
but the one I'm interested in goes like this:

<html:link forward="results">View Results</html:link>

In my struts config.xml file I have a global forwards:

<forward name="/results" path="/results.do" />

And a form bean:

<form-bean name="result" type="com.web.forms.ResultBean" />

And an action mapping:

<action path="/results"
                name="result"
                scope="request"
                        type="com.web.actions.Results" 
input="/pages/new_result.jsp">
                        <forward name="success" path="/pages/new_result.jsp" />
                </action>

What I want to do is pre populate several fields on the new_result.jsp page by 
using the setters from my ResultBean.

With in my action class I cast my bean and then use the setters but when the 
page is displayed the fields are empty.

I can populate by using the default reset method but this isn't what I want. 
How can I get a handle on the bean so as to pre populate those fields.

Any help would be appreicated.

Jim

James M. Corbett

Programmer / Analyst |
Canada Revenue Agency | Agence du revenue du Canada
875 Heron Rd.
Ottawa, On.
K1A0L5

James.Corbett@xxxxxxxxxxxxx
Telephone | Téléphone: (613) 941-1338
Facsimile | Télécopieur: (613) 941-2261

Government of Canada | Gouvernement du Canada

E = MC²


Other related posts:

  • » [program-java] Java: Form Bean - Corbett, James