tiles scope and stuff - please help!


Web tier: servlets, JSP, Web frameworks: tiles scope and stuff - please help!

  1. tiles scope and stuff - please help! (3 messages)

    I'm rather stuck with a simple tile scope/variable thing (well I think it must be simple).

    I have a tiles def – say
      <definition name="main.layout" path="/mainLayout.jsp">
              <put name="title" value=""/>
    <put name="sectionStr" value="30"/>
              <put name="toolbarStr" value="0"/>
              <put name="menu" value="/menu.jsp"/>
              <put name="header" value="/header.jsp"/>
    <put name="body" value=""/>
    <put name="footer" value="/footer.jsp" />

    I get “Error - tag.getAsString : attribute 'title' not found in context.” as the error. But I thought I'd set it into request scope. I also tried using request.getAttribute to get it but that always seems to return null.

    Threaded Messages (3)

  2. Extend main.layout[ Go to top ]

    Extend main.layout and set your values for title and body.
    and forward your request to your subtile.

    If you forward any request to main.layout most likely it willn ot work
  3. Extend main.layout[ Go to top ]

    Thanks for the reply. I've extended the mainlayout to
    <definition name="inbox" extends="main.layout">
    <put name="toolbarStr" value="1"/>
               <put name="title" value="Inbox"/>
    <put name="body" value="/inbox.jsp"/>

    Then in mainlayout.jsp I use
    <tiles:useAttribute id="title" name="title" ignore="true" scope="request" classname="java.lang.String" />

    I can do <tiles:getAsString name="title"/> here fine and I thought setting the scope to request here would mean that the subtiles could grab the value

    But in header.jsp a reference to <tiles:getAsString name="title"/> generates the same error (“Error - tag.getAsString : attribute 'title' not found in context.”)...
  4. jsp:include[ Go to top ]

    tiles are driven in the concept of jsp:include not static include concept. So as per my understanding of struts you have to use different taglib to extract the value of the request attribute