I have been trying to set up some mapped properties in a form.
It is currently not working.
Would someone please look over what I am trying to do and comment on the
technique?

This was taken from the following:
http://jakarta.apache.org/struts/faqs/indexedprops.html

I modified the code from the faq slightly, but it is essentially the same.

If this works I was hoping to populate the map with the request parameters.
Since I am using XSL to generate the pages, I can easily add <bean:write
property="stringMapped(XXXXXXXX)" name="bean" />
in order to repopulate the fields as the JSP recompiles.

This method seems to solve the problems I am having.  I would appreciate any
advice anyone has.

Thank you for your time,

Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS  Chemical Engineering

****************************************************************************
******
My setup
****************************************************************************
******

ManagerForm.java
****************************************************************************
******
public final class ManagerForm
    extends ActionForm {
  private HashMap map = new HashMap();

  public ManagerForm() {
    map.put("102_price", "578854");
  }

  public Object getStringMapped(String key) {
    return (map.get(key));
  }

  public void setStringMapped(String key, Object value) {
    map.put(key, value);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
  }

  public ActionErrors validate(ActionMapping mapping,
                               HttpServletRequest request) {

    ActionErrors errors = new ActionErrors();
    return errors;
  }
}

JSP Code
****************************************************************************
******
<jsp:useBean class="org.apache.struts.webapp.example.ManagerForm" id="bean"
/>
<bean:write property="stringMapped(102_price)" name="bean" />

Error:
****************************************************************************
******
org.apache.jasper.JasperException: No getter method for property
stringMapped(102_price) of bean bean



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

Reply via email to