You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by xbranko <xb...@netscape.net> on 2008/06/27 23:15:58 UTC
how to create menues with tiles2?
Following the example at the
http://tiles.apache.org/tutorial/advanced/menu.html tutorial page I am not
getting the menu rendered. There is no exception, and instead of the menu, I
get the iterator control variable displayed.
tiles-def.xml:
<definition name="menu" template="/Menu.jsp">
<put-list-attribute name="menu.Attributes">
<item value="Home page" link="menu.do" />
<item value="News" link="news.do" />
</put-list-attribute>
</definition>
<definition name="main" template="/main.jsp">
<put-attribute name="mymenu" value="menu" />
</definition>
Menu.jsp:
<%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<div align="center">
<tiles:importAttribute name="menu.Attributes"/>
<c:forEach var="item" items="${menu.Attributes}">
<a href="${item.link}">${item.value}</a> |
</c:forEach>
</div>
What gets rendered on the page:
http://localhost:8080/$%7Bitem.link%7D ${item.value} |
Why is this? What am I doing wrong or not setting up correctly?
This is with tiles 2.0.6
Many thanks,
Branko
--
View this message in context: http://www.nabble.com/how-to-create-menues-with-tiles2--tp18163991p18163991.html
Sent from the tiles users mailing list archive at Nabble.com.
Re: how to create menues with tiles2?
Posted by Antonio Petrelli <an...@gmail.com>.
2008/6/27 xbranko <xb...@netscape.net>:
> <tiles:importAttribute name="menu.Attributes"/>
Rick is correct, there is a problem with dots in "menu.Attributes",
because, without the "toName" attribute, it will be imported in the
"menu.Attributes" name under page scope.
So, either use a "toName" attribute, e.g.:
<tiles:importAttribute name="menu.Attributes" toName="menuAttributes"/>
<c:forEach var="item" items="${menuAttributes}">
...
Or change its use in <c:forEach>, e.g.:
<c:forEach var="item" items="${pageScope['menu.Attributes']}">
HTH
Antonio
Re: how to create menues with tiles2?
Posted by Antonio Petrelli <an...@gmail.com>.
2008/7/1 xbranko <xb...@netscape.net>:
>
>
> Antonio Petrelli-3 wrote:
>>
>> Mmm one last chance, try to use this:
>> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_rt" %>
>>
>> Antonio
>>
>>
> This gives:
> org.apache.jasper.JasperException: The absolute uri:
> http://java.sun.com/jsp/jstl/core_rt cannot be resolved in either web.xml or
> the jar files deployed with this application
Oh right, sorry, you are under Servlet 2.5, that do not need the "_rt"
versions of JSTL.
I was using this one since I use Servlet 2.4.
At this point I don't know what to say, but to try with another
application server :-(
Antonio
Re: how to create menues with tiles2?
Posted by xbranko <xb...@netscape.net>.
Antonio Petrelli-3 wrote:
>
> Mmm one last chance, try to use this:
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_rt" %>
>
> Antonio
>
>
This gives:
org.apache.jasper.JasperException: The absolute uri:
http://java.sun.com/jsp/jstl/core_rt cannot be resolved in either web.xml or
the jar files deployed with this application
Eclipse Web tools jsp editor also flagged this as a problem. Does this work
for you? Do you have a small self contained test example that you could
share? I can try it on my end and try to see what is different. Any other
idea? Anyway -- just wanted to say a big THANK YOU for all your help!
Branko
--
View this message in context: http://www.nabble.com/how-to-create-menues-with-tiles2--tp18163991p18220346.html
Sent from the tiles users mailing list archive at Nabble.com.
Re: how to create menues with tiles2?
Posted by Antonio Petrelli <an...@gmail.com>.
2008/6/30 xbranko <xb...@netscape.net>:
The ForEachTag is setting the items over which to
> iterate over to literal ${pageScope['menuAttributes']}, and not to what this
> evaluates to!
Mmm one last chance, try to use this:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_rt" %>
Antonio
Re: how to create menues with tiles2?
Posted by xbranko <xb...@netscape.net>.
I did everything that was suggested. Changed the web.xml (j2ee -> javaee),
used the 'toName' on import, used the pageScope[''] notation, but am still
getting the same behavior, i.e. no menus! I've even changed the name by
removing the dot menu.Attributes -> menuAttributes.
What else can it be? What else should I try? In the debugger can see
menuAttributes are being passed as attribute of the pageContext, but they
are not being used. The ForEachTag is setting the items over which to
iterate over to literal ${pageScope['menuAttributes']}, and not to what this
evaluates to! Where is this supposed to be evaluated?
Branko
--
View this message in context: http://www.nabble.com/how-to-create-menues-with-tiles2--tp18163991p18200945.html
Sent from the tiles users mailing list archive at Nabble.com.
Re: how to create menues with tiles2?
Posted by Antonio Petrelli <an...@gmail.com>.
2008/6/28 xbranko <xb...@netscape.net>:
> <web-app id="WebApp_ID"
> xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
> version="2.5">
Oh, BTW, this root element is wrong, since from 2.5 Sun renamed "j2ee"
to "javaee", do a search-and-replace from one to the other.
Antonio
Re: how to create menues with tiles2?
Posted by xbranko <xb...@netscape.net>.
Antonio Petrelli-3 wrote:
>
>
> I think that you have EL evaluation turned off, you have to specify at
> least Servlet 2.4 version in your web.xml file.
>
>
According to my web.xml it should be on 2.5:
<web-app id="WebApp_ID"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
version="2.5">
Is there some other way to turn EL evaluation explicitly?
Branko
--
View this message in context: http://www.nabble.com/how-to-create-menues-with-tiles2--tp18163991p18172894.html
Sent from the tiles users mailing list archive at Nabble.com.
Re: how to create menues with tiles2?
Posted by Antonio Petrelli <an...@gmail.com>.
2008/6/27 xbranko <xb...@netscape.net>:
> <a href="${item.link}">${item.value}</a> |
>...
> What gets rendered on the page:
> http://localhost:8080/$%7Bitem.link%7D ${item.value} |
I think that you have EL evaluation turned off, you have to specify at
least Servlet 2.4 version in your web.xml file.
Antonio
Re: how to create menues with tiles2?
Posted by xbranko <xb...@netscape.net>.
Rick Mangi-2 wrote:
>
> You also probably need to define an id name and type when importing
>
How does one do that? And where? In my tiles-def.xml, menu definition has a
name "menu", that is being used as a value in the other definition.
Branko
--
View this message in context: http://www.nabble.com/how-to-create-menues-with-tiles2--tp18163991p18172982.html
Sent from the tiles users mailing list archive at Nabble.com.