You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Bruyn, Bill" <Bi...@McKesson.com> on 2008/07/27 02:17:44 UTC

[struts2] tabbedpanel bug? Remote content retrieved 2/3 times

Using Struts 2.0.11, the following markup causes goodbyeWorld's execute
method to be called twice:

<sx:tabbedpanel id="tabContainer" > 

   <s:url action="goodbyeWorld" id="url"/>
   <sx:div label="Tab 1" href="%{#url}">Remote Tab</sx:div>   

   <sx:div label="Tab 2">Local Tab</sx:div> 
</sx:tabbedpanel>

When the remote content follows the local content (Tab 1 is placed after
Tab 2), it's called just once.

Switch out the libraries and change the tags accordingly to use 2.1.2
syntax, and I think you'll find that remote content on tab 1 calls the
action 3 times.  Remote content on tab 2 is called twice.


Bill
---------------------------------------------
Win XP
IE6/FF2/Safari 3.1
Tomcat 6.0.16
JDK 1.5.0_06
Struts 2.0.11 / 2.1.2 (binary)


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
  <display-name>hello</display-name>
  <filter>
    <filter-name>struts2</filter-name>
 
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-cla
ss>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>



<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <package name="base-package" namespace="/" extends="struts-default">
        <action name="helloWorld" class="hello.HelloWorld">
            <result>helloWorld.jsp</result>
        </action>
        <action name="goodbyeWorld" class="goodbye.GoodbyeWorld">
            <result>goodbyeWorld.jsp</result>
        </action>
    </package>
</struts>



package hello;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorld extends ActionSupport {

    private String message = "Hello World!";
    
    public String getMessage() {
        return message;
    }

    @Override
    public String execute() throws Exception {
	System.out.println(message);
	return SUCCESS;
    }
}



<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
    <sx:head debug="true"/>
</head>
<body>

<sx:tabbedpanel id="tabContainer" > 

   <sx:div label="Local">
        <s:property value="message"/>
   </sx:div> 

   <s:url action="goodbyeWorld" id="url"/>
   <sx:div label="Remote" href="%{#url}"/>   
 
</sx:tabbedpanel>

</body> 
</html>



package goodbye;

import com.opensymphony.xwork2.ActionSupport;

public class GoodbyeWorld extends ActionSupport {

    private String message = "Goodbye, World!";
    
    public String getMessage() {
        return message;
    }
    
    @Override
    public String execute() throws Exception {
	
	System.out.println(message);
	return super.execute();
    }
}



<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head/>
<body>
    <s:property value="message"/>
</body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org