You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "James Humphrey (JIRA)" <ji...@apache.org> on 2008/06/02 17:20:05 UTC

[jira] Commented: (WW-2662) action tag and sitemesh issue

    [ https://issues.apache.org/struts/browse/WW-2662?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44001#action_44001 ] 

James Humphrey commented on WW-2662:
------------------------------------

Correction to the above, the action result actually looked as follows:

**bar.jsp**
<html>
<body>
<p>foobar</p>
</body>
</html>

-----
After debugging this issue, it turns out that it's a Sitemesh issue, and not a struts issue at all.  Because the result contains a <body> sitemesh replaces it's <sm:body> with it, which has the effect of clobbering the old and causes it to not embed.

Therefore, the resolution to this issue is:

Whenever you use <s:action> to embed an action result in a page that's being decorated by sitemesh, the result action MUST NOT contain its own <body> tag.

I'm going to close this issue.

> action tag and sitemesh issue
> -----------------------------
>
>                 Key: WW-2662
>                 URL: https://issues.apache.org/struts/browse/WW-2662
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.1.2
>         Environment: Mac OS X 10.5.2
>            Reporter: James Humphrey
>
> When using the action taglib in a jsp decorated by sitemesh, the results of the action are not embedding correctly.
> **example.jsp**
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <html>
> <head>
>   <title>Example</title>
> </head>
> <body>
>   <p>Content Before action result</p>
>   <s:action namespace="/foo" name="bar" executeResult="true"/> <!-- defining 'flush="true"' also does not work -->
>   <p>Content after action result</p>
> </body>
> </html>
> *Bar action*
> package action.foo;
> /**
>  * Example action.
>  */
> public class Bar extends ActionSupport {
>     @Override
>     public String execute() throws Exception {
>         // stub for example purposes
>     }
> }
> **bar.jsp result**
> <p>foobar</p>
> **decorators.xml**
> <decorators defaultdir="/WEB-INF/decorators">
>   <!--
>     main decorator
>   -->
>   <decorator name="main" page="main.jsp">
>     <pattern>/*</pattern>
>   </decorator>
> </decorators>
> **main.jsp decorator***
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <%@ taglib prefix="sm" uri="http://www.opensymphony.com/sitemesh/decorator" %>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
>   <title>
>     <sm:title/>
>   </title>
>   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
>   <sm:head/>
> </head>
> <body>
>   <sm:body/>
> </body>
> </html>
> Expected output:
> ...
> <body>
>   <p>Content Before action result</p>
>   <p>foobar</p>
>   <p>Content after action result</p>
> </body>
> ...
> Actual output:
> <p>foobar</p>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.