What version of Tiles are you using?
2011/10/14 Jack <[email protected]>
> Hi Antonio,
>
> Thanks for your reply. Here is the code snippet. I have added all jars and
> imported all taglibs.
>
> If I click the following link
>
> <a href="user-overview.action">user Overview</a>
>
> If I keep tiles:user:overview definition in tiles then it's working but if
> I
> remove tiles:user:overview definition from tiles and keep tiles:*:*
> definition then it's not finding pageName aatribute. Can you please help me
> out in this situation?
>
>
> struts.xml
>
> -----------------------------------------------------------------------------------------------------------------
> <struts>
> <package name="default" extends="struts-default, tiles-default">
> <action name="showBreadcrumb" class="x.x.BreadcrumbAction">
> <result name="success" type="tiles">tiles:breadcrumb:${pageName}</result>
> </action>
> <action name="user-*" method="{1}" class="x.x.UserAction">
> <result name="success" type="tiles">tiles:user:{1}</result>
> </action>
> <action name="dept-*" method="{1}" class="x.x.DeptAction">
> <result name="success" type="tiles">tiles:dept:{1}</result>
> </action>
> </package>
> </struts>
>
> tiles.xml
>
> -----------------------------------------------------------------------------------------------------------------
> <tiles-definitions>
> <definition name="layout" template="/layout/layout.jsp">
> <put-attribute name="title" value="My App" />
> <put-attribute name="breadcrumb" value="/layout/breadcrumb.jsp" />
> <put-attribute name="body" value="" />
> </definition>
> <definition name="tiles:breadcrumb:*" template="/breadcrumb/{1}-bc.jsp" />
> <definition name="tiles:user:overview" extends="layout">
> <put-attribute name="pageName" value="user" cascade="true" />
> <put-attribute name="body" value="/user/overview.jsp" />
> </definition>
> <definition name="tiles:*:*" extends="layout">
> <put-attribute name="pageName" value="{1}" cascade="true" />
> <put-attribute name="body" value="/{1}/{2}.jsp" />
> </definition>
> </tiles-definitions>
>
> BreadcrumbAction.java
>
> -----------------------------------------------------------------------------------------------------------------
> public class BreadcrumbAction extends ActionSupport {
> private String pageName;
> public String getPageName() { return pageName; }
> public void setPageName(String pageName) { this.pageName = pageName; }
> public String execute() throws Exception { return SUCCESS; }
> }
>
> UserAction.java
>
> -----------------------------------------------------------------------------------------------------------------
> public class UserAction extends ActionSupport {
> public String overview() throws Exception { return SUCCESS; }
> public String detail() throws Exception { return SUCCESS; }
> }
>
> layout/layout.jsp
>
> -----------------------------------------------------------------------------------------------------------------
> <html>
> <head>
> </head>
> <body>
> <div class="wrapper innerWrapper breadCrumbs clearfix
> floatLeft">
> <tiles:insertAttribute name="breadcrumb" />
> </div>
> <div class="flexCol">
> <div class="flexColMargin">
> <div class="flexColWrapper boxShadow clearfix">
> <tiles:insertAttribute name="body" />
> </div>
> </div>
> </div>
> </body>
> </html>
>
> layout/breadcrumb.jsp
>
> -----------------------------------------------------------------------------------------------------------------
> <tiles:importAttribute name="pageName" ignore="true" />
> <s:action name="showBreadcrumb" executeResult="true">
> <s:param name="pageName">${pageName}</s:param>
> </s:action>
>
> breadcrumb/user-bc.jsp
>
> -----------------------------------------------------------------------------------------------------------------
> <html><body>I am user bread crumb</body></html>
>
> user/overview.jsp
>
> -----------------------------------------------------------------------------------------------------------------
> <html><body>I am user overview</body></html>
>
>
> On Fri, Oct 14, 2011 at 3:38 AM, Antonio Petrelli <
> [email protected]> wrote:
>
> > I already answered to your question. Are you correctly subscribed to the
> > mailing list?
> >
> > 2011/10/12 Mohammad Hoque <[email protected]>
> >
> > > Hi Antonio,
> > >
> > >
> > >
> > > How can I get attribute value in JSP, where attribute value is
> > > dynamically set from wildcard definition name?
> > >
> > >
> > >
> > > Thanks
> > >
> > >
> >
>