struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hutchinson <bel...@gmail.com>
Subject Re: DynaForms and EL (dynabean.map not working)
Date Wed, 24 Aug 2005 18:06:22 GMT
Figured it out. 

dynabean.map.prop

should be 

<dynabean>.map.<prop>

Where <dynabean> is the name of your form from struts-config.

You can't actually use 'dynabean'. 


On 8/24/05, John Hutchinson <belwig@gmail.com> wrote:
> I was under the impression that the form bean itself is a 'gimmie' and
> does not explicitly need to be set in the request scope (or any other
> scope for that matter).
> 
> For example, the
> <html:text property="displayName" size="25" />
> tag works without needing the 'name' property, so somehow the
> <html:text> tag knows to look in the form bean in this case. I could
> do something like you mention, but this page seems to indicate that I
> can use ${dynabean.map.prop}
> 
> http://struts.apache.org/userGuide/building_controller.html#dyna_action_form_classes
> 
> I even changed it back to org.apache.struts.action.DynaActionForm just
> to make sure it's not a LazyValidatorForm issue, but I still got
> nothing. Both implement org.apache.commons.beanutils.DynaBean so it
> should work in both cases (I think).
> 
> On 8/24/05, Hubert Rabago <hrabago@gmail.com> wrote:
> > You should try using the name you're using for the form when you pass
> > it from your action to your JSP.
> >
> > > final DynaBean dynaForm = (DynaBean)form;
> > > dynaForm.set("displayName", "test");
> >
> > If you're using request.setAttribute("displayForm", dynaForm); then try
> >
> > <c:out value="${displayForm.map.displayName} />
> >
> > Hubert
> >
> > On 8/24/05, John Hutchinson <belwig@gmail.com> wrote:
> > > Hi there.
> > >
> > > I have a form that uses org.apache.struts.validator.LazyValidatorForm.
> > >
> > > When I pre-populate this form before displaying it, I use code like
> > > the following in the action:
> > >
> > > final DynaBean dynaForm = (DynaBean)form;
> > > dynaForm.set("displayName", "test");
> > >
> > > In my JSP, I have a <html:text> element that looks like this:
> > >
> > > <html:text property="displayName" size="25" />
> > >
> > > The value 'test' is populated as expected.
> > >
> > > Now I want to change this from a <html:text> to just hard output (via
> > > <c:out>) if some boolean is true:
> > >
> > >     <c:choose>
> > >       <c:when test="${param.function == 'displayEdit'}">
> > >          <html:text property="displayName" size="25" />
> > >       </c:when>
> > >       <c:otherwise>
> > >          <c:out value="${dynabean.map.displayName} />
> > >       </c:otherwise>
> > >     </c:choose>
> > >
> > > I can't seem to get the <c:out> to render anything using the
> > > dynabean.map.prop value as described in the guide. What am I doing
> > > wrong?
> > >
> > > I'm using Struts 1.2.7 on Tomcat 5.5 with JSTL 1.1.2
> > > My includes are:
> > > <%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %>
> > > <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

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


Mime
View raw message