A small test revealed something interesting:
Removing all output from the jsp page, and printing to the console in the
toString() method of my object shows that the toString() method is called
when the property is inserted in the definition:
<tiles:putAttribute name="argument">
<s:property value="map['key']"/>
</tiles:putAttribute>
So it seems to me that the properties that are placed on the attribute for
the someminorjsppage.jsp are strings, which means i will not get the object
to work on.
It means that i would have to send the key to my someminorjsppage.jsp page,
and use this key to dig into the map of the action.
Can anybody verify for me that this would be true?
kr.Lars Dam
On Wed, Apr 30, 2008 at 4:40 PM, Lars Dam <[EMAIL PROTECTED]> wrote:
> outputting ${argument} shows content of toString() - using ${argument.name}
> gives me following error:
> "According to TLD or attribute directive in tag file, attribute value does
> not accept any expressions"
>
> To summarize:
> My tiles definition is:
>
> <tiles:insertTemplate template="/someminorjsppage.jsp">
> <tiles:putAttribute name="argument">
> <s:property value="map['key']"/>
> </tiles:putAttribute>
> </tiles:insertTemplate>
> My action has an attribute 'map' with objects mapped by keys, and i get
> the proper instance from the 'key'.
>
> The someminorjsppage.jsp is just:
>
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> <tiles:importAttribute name="argument"/>
> <tiles:useAttribute name="argument"/>
> <%-- different suggestions below, tried one at the time --%>
> <tiles:getAsString name="component"/> <%-- gives output of toString() --%>
> <s:property value="argument.name" /> <%-- gives nothing, what i would like
> to get --%>
> <s:property value="argument" /> <%-- gives nothing --%>
> ${argument} <%-- gives output of toString() --%>
> ${argument.name} <%-- gives the "According to..." error --%>
> It seems to me that i get the proper object from my map in my action,
> since it gives me proper toString() information (shows proper classname of
> instance i got from the map).
>
> But i have no idea of how i would use this instance properly in the jsp
> page - any pointers are welcome.
>
> kr. Lars Dam
>
>
>