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

Reply via email to