I am not using logic:itererate.  I am generating each
property="stringMapped(XXXXXXXX)" using xsl.  It works with indexed
properties, but not with mapped ones.  I need to use mapped properties in my
application.

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

-----Original Message-----
From: apachep2 [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 8:44 AM
To: 'Struts Users Mailing List'
Subject: RE: mapped propeties problem and need advice


I am switching from Collection to Map. What I am going to do is,

Before switching

<logic:iterate name="myactionform" property="myorder" id="mylineitem">
        <html:text name="mylineitem" property="myitemname"/>
        <html:text name="mylineitem" property="myorderquantity"/>
</logic:iterate>

After switching

<logic:iterate name="myactionform" property="myorder" id="key">
        <html:text name="key" property="value.myitemname"/>
        <html:text name="key" property="value.myorderquantity"/>
</logic:iterate>

logic:iterate tag doc tells us that "However, if you iterate over a Map,
the exposed object is of type Map.Entry that has two properties:".
According to Map.Entry Javadoc, it has getKey and getValue, in my case,
key is my item id and value returns my line item.

Don't know whether it will work but hope the above example give you some
hints.

-----Original Message-----
From: Jason Long [mailto:[EMAIL PROTECTED]
Sent: March 13, 2003 4:47 AM
To: Struts Users Mailing List
Subject: mapped propeties problem and need advice

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]

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



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

Reply via email to