Ken,

Oops, I overlooked the fact that you were iterating over a Map. For Map, your "row" bean will be of the type Map.Entry which has two properties, "key" and "value". Your MyBean instance is stored in the "value" property.

To retrieve it, you can do something like:

  <logic:iterate id="row" name="result" scope="request">
    <bean:define id="myBean" name="row" property="value" type="MyBean"/>
    <bean:write name="myBean" property="comp_name"/>
  </logic:iterate>      

This may also work (but I'm not sure):

  <logic:iterate id="row" name="result" scope="request">
    <bean:write name="row" property="value.comp_name"/>
  </logic:iterate>      

--
John



At 09:54 pm 22-10-2001 -0700, Ken'ichi Unnai wrote:

Dear John,

Thanks for your suggestion.

I still have the same problem. My beans is fairly simple, so there should
be no problem, but...? can you please try to take a look at this?

------MyBean.java--------
    private String comp_code;
    private String comp_name;
    public MyBean() {
        // Default javabean constructor
    }
    public MyBean(String comp_code, String comp_name) {
        this.comp_code = comp_code;
        this.comp_name = comp_name;
    }
    public String getComp_code(){
        return comp_code;
    }
    public void setComp_code(String comp_code) {
        this.comp_code = comp_code;
    }
    public String getComp_name() {
        return comp_name;
    }
    public void setComp_name(String comp_name) {
        this.comp_name = comp_name;
    }
   
    public String toString() {
        return ("MyBean[comp_code=" + comp_code + ", comp_name=" + comp_name +"]");
    }

------MyAction.java-------

  myHashMap.put(new Integer(1), new MyBean("0001", "First company"));
  myHashMap.put(new Integer(2), new MyBean("0002", "Second company"));

  req.setAttribute("result", myHashMap);

------result.jsp-------

  <logic:iterate id="row" name="result" scope="request">
   <bean:write name="row" property="comp_name"/>
  </logic:iterate>      


...but JSP claims with exceptions:
javax.servlet.ServletException: No getter method for property comp_name of bean
row

Possible reason is that as you pointed out, MyBean.java is wrong, but as long
as I investigate I can't find any problem...

Can you please try to look at this?


All the best,
Ken

--
John Yu                       Scioworks Technologies
e: [EMAIL PROTECTED]         w: +(65) 873 5989
w: http://www.scioworks.com   m: +(65) 9782 9610

Scioworks Camino - "Rapid WebApp Assembly for Struts"

Reply via email to