tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignacio de Córdoba <icord...@skios.es>
Subject Re: How to include a SimpleMenuItem bean in tiles:addAttribute in struts2
Date Fri, 30 Jan 2009 15:40:55 GMT

Oh, no rude at all. I am using Tiles for all the page composition in my
projects. And that is why I also wanted to use a Tile for breadcrums and not
adopt another technology just for that. I need to insert breadcrums this way
because they are placed in different positions depending if you are in
user/admin area (and more parameters... anyway...)

Focusing again on my Tiles problem. I'll try to explain it. .I'll post how I
am doing it now, which works, but mixes struts2 ONGL and starndard JSP EL. I
have a property in the struts2 Action named "folderName", which I want to
set as SimpleMenuItem value. The following code works OK, but mixes struts2
ONGL, Tiles2 and traditional JSP+EL:

<tiles:insertDefinition name="breadcrumsTile">
	<tiles:putListAttribute name="breadcrums">
		<jsp:useBean id="item" class="org.apache.tiles.beans.SimpleMenuItem"
			<c:set var='folderName'><s:property value="#folderName"/></c:set>
			<jsp:setProperty  name="item" property="link"
			<jsp:setProperty name="item" property="value" value="${folderName}"/>
			<tiles:addAttribute value="${item}"/> 	

I find this a bit complex and that is why I am looking for a way to get rid
of jsp tags and EL and only use struts2 ONGL + Tiles2, but if Tiles2 only
accepts EL to get an object (SimpleMenuItem) I guess what I want to do is
not possible.


Antonio Petrelli-3 wrote:
> 2009/1/30 Ignacio de Córdoba <icordoba@skios.es>:
>> you mean that if I replace <jsp:useProperty...> with:
>> <s:bean name="org.apache.tiles.beans.SimpleMenuItem" var='item'>
>>                        <s:param name="link" value="%{folderName}" />
>>                        <s:param name="value"
>> value="Actions_folder.action?portalid=%{userSession.portalid}&folderName=%{#parameters.folderName}"
>> />
>>                </s:bean>
> Sorry, I don't understand your question, can you elaborate on this?
>> There is no way to insert objects in the ValueStack to a tile list with a
>> tiles:addAttribute tag or anyother way?
>> I hate mixing both "EL's" in the same page. I am using ONGL for the rest
>> of
>> the code: as I am using struts2 now, I must use % ONGL syntax to access
>> Action properties, so it is tedious to make them visible to JSTL EL using
>> <s:property /> every time I have to add a Tile (in every page, as I use a
>> Tile for breadcrums!)
> Sorry to seem rude, but if you use Tiles *only* for breadcrumbs, you
> chose the wrong framework :-D
> Anyway, Tiles tags understand EL only because the container translates
> them. Struts, instead, uses OGNL internally.
> If you like, you can write an AttributeEvaluator that understands OGNL:
> http://tiles.apache.org/framework/apidocs/org/apache/tiles/evaluator/AttributeEvaluator.html
> Antonio

View this message in context: http://www.nabble.com/How-to-include-a-SimpleMenuItem-bean-in-tiles%3AaddAttribute-in-struts2-tp21739816p21749599.html
Sent from the tiles users mailing list archive at Nabble.com.

View raw message