You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "zhouyanming (JIRA)" <ji...@apache.org> on 2010/01/08 05:48:46 UTC

[jira] Commented: (WW-3330) <@s.action> broken in sitemesh freemarker decorator page

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

zhouyanming commented on WW-3330:
---------------------------------

finally I find a solution

1.add a few lines code to org.apache.struts2.views.freemarker.FreemarkerResult.preTemplateProcess(Template template, TemplateModel model) 

		if(ServletActionContext.getRequest().getAttribute(StrutsStatics.STRUTS_ACTION_TAG_INVOCATION) != null){
			response.setContentType(null);   //trigger com.opensymphony.module.sitemesh.filter.PageResponseWrapper.deactivateSiteMesh()
        	return true;
		}

2.refactor code in com.opensymphony.module.sitemesh.filter.PageResponseWrapper.setContentType(String type)

    public void setContentType(String type) {
        boolean deactivate = false;
        if (type != null) {
            super.setContentType(type);
            HttpContentType httpContentType = new HttpContentType(type);

            if (parserSelector.shouldParsePage(httpContentType.getType())) {
                activateSiteMesh(httpContentType.getType(), httpContentType.getEncoding());
            } else {
            	deactivate = true;
            }
        }else{
        	deactivate = true;
        }
        if(deactivate)
        	deactivateSiteMesh();
    }


this solution have such restriction
1.must hack sitemesh
2.response.setContentType(null);  is incompatibility with non-sitemesh app,it will override previous ContentType.

Is there any perfect solution to trigger deactivateSiteMesh?

> <@s.action> broken in sitemesh freemarker decorator page
> --------------------------------------------------------
>
>                 Key: WW-3330
>                 URL: https://issues.apache.org/struts/browse/WW-3330
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - SiteMesh
>            Reporter: zhouyanming
>            Assignee: Musachy Barroso
>            Priority: Blocker
>             Fix For: 2.2.0
>
>
> broken since this patch   https://issues.apache.org/struts/browse/WW-3291 
> <div id="left"><@s.action name="left" executeResult="true" /></div>
> <div id="content">${body}</div>
> <div id="right"><@s.action name="right" executeResult="true" /></div>

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