Hmmm.... I looked in the example application (editResgistration). I have
similar code, but still doesn't work for me.

Here is snippets of my code:
In struts-config.xml
====================

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

    <action    path="/getpersonnel"
               type="blankApp.PersonnelAction"
               name="personnelForm"
              scope="request"
              validate="false">


In PersonnelAction.java
=========================
    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
        throws Exception 
  {

    // Extract attributes we will need
        Locale locale = getLocale(request);
        MessageResources messages = getResources(request);
        HttpSession session = request.getSession();

      System.out.println("I am in Personnel Action");
      PersonnelForm fForm = (PersonnelForm)form;

      PersonnelVO personnelVO = new PersonnelVO();  // has 'rank' and
'paygrade' properties
   
      personnelVO.setRank("RANK");
      personnelVO.setPaygrade("PG");      

      PropertyUtils.copyProperties(fForm, personnelVO);      
      System.out.println(fForm.getRank());
      System.out.println(fForm.getPaygrade());      

     
      // Forward control to the specified success URI
        return (mapping.findForward("success"));

    }

And finally here is personnel.jsp
=================================

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<html:html locale="true">
<head>
<title><bean:message key="index.title"/></title>
<html:base/>
</head>
<body bgcolor="white">

<html:errors/>

<html:form action="/updaterank" focus="rank">
<table border="0" width="100%">


<h3><center><bean:message key="index.message.getrank"/></center></h3>
  <tr>
    <th align="right">
      <bean:message key="prompt.rank"/>
    </th>
    <td align="left">
      <html:text property="rank"  size="16" maxlength="16"/>
    </td>
  </tr>

  <tr>
    <th align="right">
      <bean:message key="prompt.paygrade"/>
    </th>
    <td align="left">
      <html:text property="paygrade" size="16" maxlength="16"/>
    </td>
  </tr>

  <tr>
    <td align="right">
      <html:submit property="submit" value="Submit"/>
    </td>
    <td align="left">
      <html:reset/>
    </td>
  </tr>

</table>

</html:form>

</body>
</html:html>

=========================
When I access "/getpersonnel.do" action,
I expect that after my PersonnelAction.execute() function returns and
personnel.jsp is executed, I would see HTML text
controls filled with "RANK" and "PG" values. But they appear blank.....

What am I missing here..??

thanks for all the help..



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


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

I had the opposite problem... things were magically appearing in the HTML
form and I couldn't see how.  I had started with the example app, and I
finally found the line, which I commented appropriately:

/*
 *  Magic!  This populates all of the ContactForm
 *  properties with the matching ones in the Contact
 */
PropertyUtils.copyProperties( contactform, contact );

'contact' is my Value Object, and 'contactform' is the [extension of]
ActionForm. 

HTH!  Take a look at struts-example to see how it works.

-- 
Wendy Smoak
http://sourceforge.net/projects/unidbtags 

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

Reply via email to