struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Avdic <denis.av...@gmail.com>
Subject Re: Ancient (1.1) Struts Help - Map Backed Forms
Date Wed, 02 Nov 2005 18:10:34 GMT
Forget that.
They're actually running 1.0.2.  No map backed forms for me.


Sorry for wasting your time.

D

On 11/2/05, Denis Avdic <denis.avdic@gmail.com> wrote:
> Hello list,
>
> I've recently moved jobs and landed in a position where I have to
> develop with Struts 1.1 (don't ask me why they don't want to upgrade).
>
> In any case, I need to use map-backed ActionForm, first time we're
> doing this in the company looks like.
>
> I am running into problems that I've previously solved by using JSTL.
> However that is another no-no.
>
> Basically the problem is this.  When trying to access the page I get
> this error:
>
> javax.servlet.jsp.JspException: No getter method for property
> value(officeCell_2001) of bean org.apache.struts.taglib.html.BEAN
>        at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517)
>
>
> JSP snip:
>
> <logic:iterate id="position" name="positions"
> type="com.foo.bar.bat.MFPositionContact">
>
>                      <% String curPos =
> Integer.toString(position.getEmployeeId());
>
>  prop = "value(officePhone_"+curPos+")"; %>
>    <html:text property="<%=prop%>"/>
>    <html:text property="value(officeCell_<%=curPos%>)"/>
>    <html:hidden property="value(userId_<%=curPos%>)"/>
> </logic:iterate>
>
>
> Form:
>
> public class MFEditForm extends ActionForm {
>  public MFEditForm() {
>
>  }
>
>  private String officeId;
>  private Map values = new HashMap();
>
>  public String getOfficeId() {   return officeId;  }
>  public String getValue(String key) {    return (String) values.get(key);  }
>  public void setOfficeId(String oid) {    officeId = oid;  }
>  public void setValue(String key, Object value) {    values.put(key, value); }
>
> }
>
> from struts-config.xml
>
> <form-bean name="mFForm" type="com.foo.bar.bat.MFEditForm"/>
>
> <action path="/multiFoldReportAction"
>                type="com.foo.bar.bat.ReportAction"
>                name="mFForm"
>                scope="request"
>                validate="true">
>
>        <forward name="mFFOfficesEdit" path="/jsp/bat/mFFOfficeEdit.jsp"/>
> </action>
>
> I prepopulate the formBean and set it in request.  The formBean is
> getting associated correctly with the form on JSP (I checked by
> outputing the officeId without touching the map).  Interesting thing
> is that if I don't use getter methods (IE, if I use <html:hidden
> property="value(userId_<%=curPos%>)" value="foo"/>)
> there is no error.  It seems to me that the getter method is somehow
> wrong, but I can't see it.
>
> I tried these getValue signature variations:
>
> public String getValue(String key)
> public Object getValue(Object key)
> public String getValue(Object key)
> public Object getValue(String key)
>
>
> It seems to me that this plain vanilla map backed ActionForm should
> work without a hitch.  Am I missing something really obvious?  I
> really can't use JSTL or EL tags so if there is a solution not
> involving those, please let me know.
>
> Thanks,
>
> Denis
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message