Hi,

I’m working on an application that’s designed to render dynamic pages that take as input an ArrayList of DisplayItemBeans. Each DisplayItemBean has properties that define:
(a) the UI widget type (text, checkbox, radio button, etc)
(b) the data item’s db column name (used as key in an action form Map)
(c) for selection-type widgets (listbox, checkbox, radio button), a list of available options.


I defined a Map-backed ActionForm and a jsp template to work with this ArrayList (pls see code snippets below). The pages render fine for all types of widgets except checkboxes. When I use the html:multibox tag, I encounter the following problem:

[ServletException in:/WEB-INF/jsp/dynaBody.jsp] No getter method available for property multibox_key_name for bean under name org.apache.struts.taglib.html.BEAN'

However, using the same code, if I just change the widget type to radio button or select, things work fine. I’d appreciate any comments on what I did wrong and suggestions on how I can fix it.

Thanks

------------- CODE SNIPPETS FOLLOW ----------------

============= ACTION FORM =========================

public class OnlsDynaActionForm extends ActionForm {

  public OnlsDynaActionForm() {
        super();
  }

  //QUES: Sample from jakarta website declared this Map as final.
  //Does it need to be final? What's the advantage of using final?
  private final Map values = new HashMap();

  public void setValue(String key, Object value) {
     values.put(key, value);
  }

  public Object getValue(String key) {
     return values.get(key);
  }
}

======================= JSP =========================

[Assume that dispList, an ArrayList of DisplayItemBeans, exists in some scope and:
- has get/set methods for scrn_clmn (label to display), db_clmn (column name used as key in ActionForm map), options (ArrayList of LabelValueBeans containing choices for selection widgets)
- has helper methods such as isUITypeCheckbox() to identify what type of widget it is]


<logic:iterate id="dib" name="dispList" type="DisplayItemBean" >
<tr>
<bean:define id="db_clmn" value='<%= "value(" + dib.getDb_clmn() + ")" %>'/>
<td><bean:write name="dib" property="scrn_clmn" /></td>
<td>
<% if (dib.isUITypeCheckbox() ) { %>
<logic:iterate id="opt" name="dib" property="options" type="org.apache.struts.util.LabelValueBean" >
<html:multibox property="<%=dib.getDb_clmn()%>" >
<bean:write name="opt" property="value" />
</html:multibox>
<bean:write name="opt" property="label" />
</logic:iterate>
<% } else if (dib.isUITypeRadiobutton() ) { %>
... display using html:radio
<% } else if ...{ %>
...handle other cases
<% } %>
</td>
</tr>
</logic:iterate>


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail



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



Reply via email to