tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abhishek Vishwakarma <abhishek.vishwaka...@gmail.com>
Subject Re: Issue with Nested Tiles while integrating with Spring 3.0
Date Mon, 24 Dec 2012 13:04:53 GMT
Hi Nick,

Thanks a lot for your suggestion.
As suggested by you I have tried to change the <tiles:insetAttribute> to
<tiles:insertTemplate> and run the application in my sample application
where all the tiles are defined in single tiles file which works fine. When
I am applying the same in my internationalization application then I am
getting below error in Internet explorer.
Please can you advise on same. For reference attached (code snippet and
tiles configurations).

*Error 403: SRVE0190E: File not found:
/WEB-INF/MyApp/common/tiles/layouts/${bodyItem} ** *

Here I have my tiles-defs.xml as well as tiles-ukd-defs.xml.

The extend layout (parent) is configured in *tiles-defs.xml* like below

<definition name="ActionEnroll"
template="/WEB-INF/MyApp/common/tiles/layouts/main.jsp">
<put-attribute name="Header1"
value="/WEB-INF/MyApp/common/common/topnav.jsp" />
<put-list-attribute name="body">
</put-list-attribute>

Below is my* tiles-UKD-defs.xml* where I am extending parent definition

<definition name="enroll.UKD" extends="ActionEnroll">
                <put-list-attribute name="body">
                                <add-attribute
value="/WEB-INF/MyApp/common/tiles/enroll/a.jsp" />
</put-list-attribute>
</definition>

In main.jsp I have written as you suggest like this

<tiles:useAttribute id="bodyList" name="body" classname="java.util.List" />
<c:forEach  var="bodyItem" items="${bodyList}" >
                <tr>
                       <td valign="top" align='left'>
                             <tiles:insertTemplate template="${bodyItem}"
flush="false" />
                        </td>
                </tr>
</c:forEach>


But this is giving error in the explorer as
*Error 403: SRVE0190E: File not found:
/WEB-INF/MyApp/common/tiles/layouts/${bodyItem} ** *

But when I iterate the bodyItem in scriptlet  like below

Iterator it=bodyList.iterator();
System.out.println(“jspà”+it.next())

then it is properly giving the file path of a.jsp like
WEB-INF/MyApp/common/tiles/enroll/a.jsp

Regards,

Abhishek

On Sun, Dec 23, 2012 at 11:58 PM, Nicolas LE BAS <mail@nlebas.net> wrote:

> Hi,
>
> Keeping things short: the problem happens because you shouldn't be using
> tiles:insertAttribute for this purpose. Use tiles:insertTemplate instead.
>
> The difference is simple: tiles:insertAttribute is in charge of
> retrieving the value of an attribute (given its name or the Attribute
> object). Once that value is known, tiles:insertAttribute internally
> calls insertTemplate for rendering.
>
> In your situation, tiles:useAttribute is retrieving the value of the
> attribute and assigning it to a JSP "variable". What's left is only
> rendering it, with insertTemplate.
>
> Hope this helps,
> Nick.
>
> PS: for further details about insertTemplate syntax, please see
> http://tiles.apache.org/2.2/framework/tiles-jsp/tlddoc/index.html
>
> On 12-12-23 07:40 AM, Abhishek Vishwakarma wrote:
> [...]
> >       <definition name=*"contact"* extends=*"base.definition"*>
> >
> >             <put-attribute name=*"title"* value=*"Contact Manager"* />
> >
> >             <put-list-attribute name=*"body"*>
> >
> >                   <add-attribute value=*"/WEB-INF/jsp/contact.jsp"*></
> > add-attribute>
> >
> >             </put-list-attribute>
> >
> >       </definition>
> [...]
> > <tiles:useAttribute  classname=*"java.util.List"* id=*"bodyList"* name=*
> > "body"*/>
> [...]
> >             <c:forEach var=*"bodyItems"* items="${bodyList}" >
> >
> >
> >
> >                   <td width=*"350"*><tiles:insertAttribute  value="
> > ${bodyItems}"></tiles:insertAttribute> </td>
> >
> >             </c:forEach>
> [...]
> > When I say *"*><tiles:insertAttribute  value="${bodyItems}"></
> > tiles:insertAttribute> </td>  here it is throwing exception and I am
> using
> > below jars
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message