You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Karsten Krieg <kk...@intarsys.de> on 2004/09/09 12:13:45 UTC
Actionform backed by Map for use in Struts-Faces
Hi List!
I'm using an Map-based Actionform for generating a number of input fields
based on the result of a database query. The actionform is implemented as
follows
public class MapForm extends ActionForm {
private Map values = new HashMap();
public void setValue(String key, Object value) {
getValues().put(key, value);
}
public Object getValue(String key) {
return getValues().get(key);
}
public Map getValues() {
return values;
}
}
I've used this map with the following html:text tag with an iteration over
another map named "keys" using the result "field. This map "keys" contains
the relevant map entries for input.
<c:forEach var="field" items="${state.attributes.keys}">
<html:text property="<%= "value(" +
((de.intarsys.efselect.util.AbstractFieldDescription)
pageContext.findAttribute("field")).getName() + ")" %>"/>
</c:forEach>
This works fine within Struts. However, I'm now migrating to JSF and
Struts-Faces integration library. I'd use the following construct:
<h:inputText id="<%= "value(" +
((de.intarsys.efselect.util.AbstractFieldDescription)
pageContext.findAttribute("field")).getName() + ")" %>"/>
This does not work, because the id attribute does not accept any
expressions. Any ideas how to solve this?
Thanks
Karsten Krieg
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Actionform backed by Map for use in Struts-Faces
Posted by Craig McClanahan <cr...@gmail.com>.
What you are running into is not an issue with the Struts-Faces
integration library. There are significant issues interoperating
between JSTL and JSF -- in particular, you will need to use something
like the UIData component (using either the standard <h:dataTable>
tag, or with some other renderer) to do repeated rendering in things
like tables. Trying to interoperate with <c:forEach> is not going to
work.
Craig
On Thu, 9 Sep 2004 12:13:45 +0200, Karsten Krieg <kk...@intarsys.de> wrote:
> Hi List!
>
> I'm using an Map-based Actionform for generating a number of input fields
> based on the result of a database query. The actionform is implemented as
> follows
>
> public class MapForm extends ActionForm {
>
> private Map values = new HashMap();
>
> public void setValue(String key, Object value) {
> getValues().put(key, value);
> }
>
> public Object getValue(String key) {
> return getValues().get(key);
> }
>
> public Map getValues() {
> return values;
> }
> }
>
> I've used this map with the following html:text tag with an iteration over
> another map named "keys" using the result "field. This map "keys" contains
> the relevant map entries for input.
>
> <c:forEach var="field" items="${state.attributes.keys}">
> <html:text property="<%= "value(" +
> ((de.intarsys.efselect.util.AbstractFieldDescription)
> pageContext.findAttribute("field")).getName() + ")" %>"/>
> </c:forEach>
>
> This works fine within Struts. However, I'm now migrating to JSF and
> Struts-Faces integration library. I'd use the following construct:
>
> <h:inputText id="<%= "value(" +
> ((de.intarsys.efselect.util.AbstractFieldDescription)
> pageContext.findAttribute("field")).getName() + ")" %>"/>
>
> This does not work, because the id attribute does not accept any
> expressions. Any ideas how to solve this?
>
> Thanks
>
> Karsten Krieg
>
> ---------------------------------------------------------------------
> 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