Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4724

s:action tag with tile result causing StackOverflowError

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.30
    • Fix Version/s: None
    • Component/s: Core Tags
    • Labels:
      None
    • Environment:

      windows 10, tomcat 7

      Description

      struts action tag used within tiles framework
      goes in recursive loop and throws StackOverflowError as below.
      Opening jira ticket as it's reproduced in showcase sample application,
      The same usage worked in struts 2.2.1.1

      to reproduce invoke http://localhost:8080/showcase/tiles/index.action.

      below is the tiles.xml , struts-tile.xml and layout.jsp as below.

      it throws

      java.lang.StackOverflowError: null at org.apache.catalina.core.ApplicationHttpRequest.getAttribute(ApplicationHttpRequest.java:230)
               at org.apache.catalina.core.ApplicationHttpRequest.getAttribute(ApplicationHttpRequest.java:230) at 
      

      following is the source code.
      Layout.jsp

      <html>
      <head>
          <title>Struts2 Showcase - <tiles:getAsString name="title"/></title>
      </head>
      <body>
          <tiles:insertAttribute name="header"/>
          <tiles:insertAttribute name="body"/>
          <p>Notice that this is a layout made in JSP</p>
          <!-- Vishal- action tag which is causing issue with tiles result --> 
          <s:action name="myTestAction" namespace="/tiles" executeResult="true" />
      </body>
      </html>
      

      tiles.xml

          <definition name="showcase.index" template="/WEB-INF/tiles/layout.jsp">
              <put-attribute name="title" value="Tiles Showcase"/>
              <put-attribute name="header" value="/WEB-INF/tiles/header.jsp"/>
              <put-attribute name="body" value="/WEB-INF/tiles/body.jsp"/>
          </definition>
             <!-- Vishal-- my definition -->
          <definition name="showcase.index.actionResult" template="/WEB-INF/tiles/actionTileResult.jsp">
              <put-attribute name="title" value="Tiles Result from action"/>
          </definition>    
      

      struts-tiles.xml

      <action name="index">
          <result type="tiles">showcase.index</result>
          <result name="success" type="tiles">showcase.index</result>
      </action>
      <!-- my test action to replicate the issue -->
      <action name="myTestAction">
          <result type="tiles">showcase.index.actionResult</result>
          <result name="success" type="tiles">showcase.index.actionResult</result>
      </action>
      

      actionTileResult.jsp

      <tiles:importAttribute name="title" scope="request"/>
      <html>
      <head>
          <title>Action tile result <tiles:getAsString name="title"/></title>
      </head>
      <body>
          <p>Notice that this is a  jsp</p>
      </body>
      </html>
      

        Attachments

        1. tiles.xml
          3 kB
          Vishal Jhagadiawala
        2. struts-tiles.xml
          1 kB
          Vishal Jhagadiawala
        3. actionTileResult.jsp
          0.1 kB
          Vishal Jhagadiawala
        4. layout.jsp
          0.5 kB
          Vishal Jhagadiawala

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vish_212 Vishal Jhagadiawala
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: