I tried it, and I still don't see Text fields populated in HTML form..

Does this mean I will have to manually write code to get handle to fForm
from 'request' and call fForm.getXXX() in my JSP file ??

I thought html:text property="XXX" should automatically get the matching
property value from the ActionForm in the similar way it does while POSTing.

I must be missing something here...



-----Original Message-----
From: William Wan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 08, 2002 3:18 PM
To: 'Struts Users Mailing List'
Subject: RE: How to get data back from ActionForm to HTML form


You have to add 
request.setAttribute("personnelForm ", fForm);
in the action so that the form will be stored in the request for
population in jsp. Otherwsie the tForm will only be available within
your action scope only.

-----Original Message-----
From: Rohra, Prakash N. ,,DMDC/BEAU [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 09, 2002 3:02 AM
To: '[EMAIL PROTECTED]'
Subject: How to get data back from ActionForm to HTML form

Hello..

I am a newbie to Struts. While reading the documentation, I gathered
that
"ActionForm" objects can be used to move data back and forth between
HTML
forms fields and ActionForm properties by using the formBeans.

With proper entries in struts-congif.xml, Struts framework automatically
creates the instance of "ActionForm" class and populates its properties
based on the HTTP Post Request parameters while submitting a HTML form.
I
can see the form values in m y ActionForm and also in Action class.

However, how do I achieve the same thing backwards. I mean, if I
retrieve or
generate some values in a Action class code, and populate these values
in
the ActionForm by calling myForm.setXXX(), I don't see these values
appearing in the corresponding HTML form that gets forwarded by my
Action.

here is the part of my struts-config.xml

    <form-bean      name="personnelForm"
                    type="blankApp.PersonnelForm"/>


    <action    path="/getpersonnel"
               type="blankApp.PersonnelAction"
               name="personnelForm"
              scope="request"
              input="/personnel.jsp" >
             <forward name="success"   path="/personnel.jsp" />
    </action>

Here is the code from PersonnelAction.java:

public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
        throws Exception 
{

      PersonnelForm fForm = (PersonnelForm)form;
      fForm.setRank("RANK");
      fForm.setPaygrade("PG");

      System.out.println(fForm.getRank());
      System.out.println(fForm.getPaygrade());

}


Where rank, paygrade are properties of PersonnelForm.java and also
defined
as html:text in personnel.jsp.

When I execute the /getpersonnel.do action, I see my code getting
executed
in PersonnelAction.java, but muy text fields in HTML form generated by
personnel.jsp are blank. I expected it to display the data from
PersonnelForm properties.

What am I doing wrong?

thanks

-Prakash




--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to