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

strange behavior of s:a tag with s:include tag inside

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.5.12
    • Labels:
      None
    • Environment:

      Windows XP SP3, Java SE 1.6.0_02 build 06, Apache tomcat 7.0.8

      Description

      I have two files.

      test.jsp
      <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      <%@ taglib uri="/struts-tags" prefix="s" %>
      <s:set name="depId" value="1" scope="page"/>
      <s:a id="%{#attr.depId}" href="javascript:some-javascript-method('%{#attr.depId}')">
      	<s:include value="test2.jsp"/>
      </s:a>
      
      test2.jsp
      <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      <%@ taglib uri="/struts-tags" prefix="s" %>
      <s:set name="test" value="1" scope="page"/>
      1
      

      The result of call http://localhost:8080/myapp/test.jsp is:

      <a id="1" href="javascript:some-javascript-method('')">1</a>
      

      as we can see, second evaluation of %{#attr.depId} is missing (must be javascript:some-javascript-method('1')). I cannot understand why it happens.
      But when I remove line <s:set name="test" value="1" scope="page"/> from test2.jsp file and call again I receive correct result:

      <a id="1" href="javascript:some-javascript-method('1')">1</a>
      

      Is this a bug or I do not understand something in Struts2

      1. StrutsBugTest.war
        4.15 MB
        Alexander Visokov
      2. WW-3659.patch
        2 kB
        Lukasz Lenart

        Activity

        Hide
        maurizio.cucchiara Maurizio Cucchiara added a comment -

        Don't call the jsp directly, otherwise struts filter is not triggered. Ask this kind of question to the user ML

        Show
        maurizio.cucchiara Maurizio Cucchiara added a comment - Don't call the jsp directly, otherwise struts filter is not triggered. Ask this kind of question to the user ML
        Hide
        sviborg Alexander Visokov added a comment -

        Hmm...
        Struts filter triggers on all pages in my app.

        web.xml
        -------
        <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
        </filter>
        <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
        </filter-mapping>

        Show
        sviborg Alexander Visokov added a comment - Hmm... Struts filter triggers on all pages in my app. web.xml ------- <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
        Hide
        sviborg Alexander Visokov added a comment -

        I do not understand comment about struts filter. In my app struts filter triggers on all pages.

        Show
        sviborg Alexander Visokov added a comment - I do not understand comment about struts filter. In my app struts filter triggers on all pages.
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Could you first post your question to user group ?

        user@struts.apache.org>

        Show
        lukaszlenart Lukasz Lenart added a comment - Could you first post your question to user group ? user@struts.apache.org>
        Hide
        sviborg Alexander Visokov added a comment -

        Posted

        Show
        sviborg Alexander Visokov added a comment - Posted
        Hide
        sviborg Alexander Visokov added a comment -

        I've created test-project (attached StrutsBugTest.war). In it I call test.action (at index.html) resulting to test.jsp. The same strange behavior.

        Show
        sviborg Alexander Visokov added a comment - I've created test-project (attached StrutsBugTest.war). In it I call test.action (at index.html) resulting to test.jsp. The same strange behavior.
        Hide
        sviborg Alexander Visokov added a comment -

        Reattach

        Show
        sviborg Alexander Visokov added a comment - Reattach
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Patch that solves the problem but can break backward compatibility

        Show
        lukaszlenart Lukasz Lenart added a comment - Patch that solves the problem but can break backward compatibility
        Hide
        maurizio.cucchiara Maurizio Cucchiara added a comment -

        Downgraded to minor priority as it is an unusual case

        Show
        maurizio.cucchiara Maurizio Cucchiara added a comment - Downgraded to minor priority as it is an unusual case
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        I cannot reproduce this issue in the latest Struts 2.5.10.1 version, marking as fixed

        Show
        lukaszlenart Lukasz Lenart added a comment - I cannot reproduce this issue in the latest Struts 2.5.10.1 version, marking as fixed

          People

          • Assignee:
            lukaszlenart Lukasz Lenart
            Reporter:
            sviborg Alexander Visokov
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development