0 Replies Latest reply: May 1, 2012 6:03 AM by 934254 RSS

    WebLogic and rendering of nested Tiles - static content is ignored

    934254
      We have a large web application, some of which uses Apache Tiles which, in places, are heavily nested. On all web application containers tested (Tomcat, JBoss, JonAs and I think WebSphere) there have been no issues, however on WebLogic we have problems.

      On WebLogic our nested tiles don't get rendered properly; only dynamic server-side scripted content gets rendered, all static (i.e. plain HTML content) gets ignored. Why is this?

      Environment details:

      - OS: Windows and Solaris (seems irrelevant)
      - Java version: 6
      - WebLogic: 11gR1
      - Apache Tiles: 2.2.2

      The issue may be caused by improper use of Tiles and how they should be nested, if so please let me know, but ideally, due to the extent of this, possibly improper use, we'd like to find a workaround.

      We did try changing the character encoding to avoid use of WebLogic's JSPWriter (from a quick inspection of source code, the choice of JSPWriter depends on character encoding settings). Changing encoding to a combination of UTF-8 and UTF-16 (which was wrong and broke things in other containers) fixed the WebLogic issue because it no longer used WebLogic's JSPWriter (and all that came with it).

      Example WAR:

      I have produced a very simple example that demonstrates this issue:

      displayTable.jsp

      <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
      <div id="displayTable" class="displayTable">
      <p><%= "This gets printed" %></p>
      <!-- But this doesn't... -->
      <table>
      <tbody>
      <tr>
      <td>This doesn't</td>
      <td>1</td>
      </tr>
      <tr>
      <td>get printed</td>
      <td>2</td>
      </tr>
      <tr>
      <td>...no it doesn't</td>
      <td>3</td>
      </tr>
      </tbody>
      </table>
      </div>

      The page that imports displayTable.jsp; test.jsp:

      <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
      <tiles:insertDefinition name="pageTemplate">
      <tiles:putAttribute name="pageContent">
      <div>
      <p>Test</p>
      </div>
      <div>
      <tiles:insertDefinition name="displayTable" />
      </div>
      </tiles:putAttribute>
      </tiles:insertDefinition>

      The page template; pageTemplate.jsp:

      If test.jsp didn't wrap contents using this file, everything works...

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
      <tiles:useAttribute name="pageContent" />
      <html>
      <head>
      <title>Testing WebLogic and nested tiles</title>
      </head>
      <body>
      <tiles:insertAttribute name="pageContent" />
      </body>
      </html>

      The output source of the above:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html>
      <head>
      <title>Testing WebLogic and nested tiles</title>
      </head>
      <body>
      <div>
      <p>Test</p>
      </div>
      <div>
      This gets printed?
      </div>
      </body>
      </html>

      I can provide the rest of the WAR contents if required, please ask.

      P.S. How do you format code in this forum?