You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Alexey Koloskov (JIRA)" <ji...@apache.org> on 2007/10/12 12:40:38 UTC

[jira] Created: (WW-2246) Impossible to use custom jsp taglibs inside custom FM template tags

Impossible to use custom jsp taglibs inside custom FM template tags
-------------------------------------------------------------------

                 Key: WW-2246
                 URL: https://issues.apache.org/struts/browse/WW-2246
             Project: Struts 2
          Issue Type: Bug
          Components: Views
    Affects Versions: 2.0.9
         Environment: Windows OS, J2SE 1.6, J2EE 5, Struts2
            Reporter: Alexey Koloskov


I create custom UI tags for Struts2 using FreeMarker. Inside FreeMarker
template I use custom jsp tags library, e.g. displaytag as follows:
<#assign display=JspTaglibs["http://displaytag.sf.net/el"]>
<@display.table name="parameters.entities"/>.

But during template rendering I get a such error:
"freemarker.template.TemplateModelException: out != pageContext.getOut().
Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut()
is null" at
freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156).


It seems like a bug because for the first time
FreeMarkerPageContext.getOut() always return null, and the check if(out !=
pageContext.getOut()) is always true for JSPWriter.

Stack trace:
error when rendering out != pageContext.getOut(). Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
The problematic instruction:
----------
==> user-directive display.table [on line 4, column 1 in template/xhtml/EntityList.ftl]
----------
Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: out != pageContext.getOut().
Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
at
freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156)
at freemarker.core.Environment.visit(Environment.java:220)
...(tale is omitted)

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


[jira] Updated: (WW-2246) Impossible to use custom jsp taglibs inside custom FM template tags

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown updated WW-2246:
--------------------------

    Fix Version/s:     (was: 2.1.4)
                   2.1.3

> Impossible to use custom jsp taglibs inside custom FM template tags
> -------------------------------------------------------------------
>
>                 Key: WW-2246
>                 URL: https://issues.apache.org/struts/browse/WW-2246
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>         Environment: Windows OS, J2SE 1.6, J2EE 5, Struts2
>            Reporter: Alexey Koloskov
>             Fix For: 2.1.3
>
>
> I create custom UI tags for Struts2 using FreeMarker. Inside FreeMarker
> template I use custom jsp tags library, e.g. displaytag as follows:
> <#assign display=JspTaglibs["http://displaytag.sf.net/el"]>
> <@display.table name="parameters.entities"/>.
> But during template rendering I get a such error:
> "freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut()
> is null" at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156).
> It seems like a bug because for the first time
> FreeMarkerPageContext.getOut() always return null, and the check if(out !=
> pageContext.getOut()) is always true for JSPWriter.
> Stack trace:
> error when rendering out != pageContext.getOut(). Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> The problematic instruction:
> ----------
> ==> user-directive display.table [on line 4, column 1 in template/xhtml/EntityList.ftl]
> ----------
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156)
> at freemarker.core.Environment.visit(Environment.java:220)
> ...(tale is omitted)

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


[jira] Commented: (WW-2246) Impossible to use custom jsp taglibs inside custom FM template tags

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44160#action_44160 ] 

James Holmes commented on WW-2246:
----------------------------------

Is this a Struts 2 issue or a Freemarker issue? At first glance it seems like a Freemarker issue.

> Impossible to use custom jsp taglibs inside custom FM template tags
> -------------------------------------------------------------------
>
>                 Key: WW-2246
>                 URL: https://issues.apache.org/struts/browse/WW-2246
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>         Environment: Windows OS, J2SE 1.6, J2EE 5, Struts2
>            Reporter: Alexey Koloskov
>             Fix For: 2.1.3
>
>
> I create custom UI tags for Struts2 using FreeMarker. Inside FreeMarker
> template I use custom jsp tags library, e.g. displaytag as follows:
> <#assign display=JspTaglibs["http://displaytag.sf.net/el"]>
> <@display.table name="parameters.entities"/>.
> But during template rendering I get a such error:
> "freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut()
> is null" at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156).
> It seems like a bug because for the first time
> FreeMarkerPageContext.getOut() always return null, and the check if(out !=
> pageContext.getOut()) is always true for JSPWriter.
> Stack trace:
> error when rendering out != pageContext.getOut(). Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> The problematic instruction:
> ----------
> ==> user-directive display.table [on line 4, column 1 in template/xhtml/EntityList.ftl]
> ----------
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156)
> at freemarker.core.Environment.visit(Environment.java:220)
> ...(tale is omitted)

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


[jira] Commented: (WW-2246) Impossible to use custom jsp taglibs inside custom FM template tags

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44201#action_44201 ] 

Don Brown commented on WW-2246:
-------------------------------

Can you use the jsp tag libraries in the normal Freemarker page?  Is it only when you use them in a template for a Struts 2 UI tag that it throws that exception?

> Impossible to use custom jsp taglibs inside custom FM template tags
> -------------------------------------------------------------------
>
>                 Key: WW-2246
>                 URL: https://issues.apache.org/struts/browse/WW-2246
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>         Environment: Windows OS, J2SE 1.6, J2EE 5, Struts2
>            Reporter: Alexey Koloskov
>             Fix For: 2.1.3
>
>
> I create custom UI tags for Struts2 using FreeMarker. Inside FreeMarker
> template I use custom jsp tags library, e.g. displaytag as follows:
> <#assign display=JspTaglibs["http://displaytag.sf.net/el"]>
> <@display.table name="parameters.entities"/>.
> But during template rendering I get a such error:
> "freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut()
> is null" at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156).
> It seems like a bug because for the first time
> FreeMarkerPageContext.getOut() always return null, and the check if(out !=
> pageContext.getOut()) is always true for JSPWriter.
> Stack trace:
> error when rendering out != pageContext.getOut(). Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> The problematic instruction:
> ----------
> ==> user-directive display.table [on line 4, column 1 in template/xhtml/EntityList.ftl]
> ----------
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156)
> at freemarker.core.Environment.visit(Environment.java:220)
> ...(tale is omitted)

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


[jira] Commented: (WW-2246) Impossible to use custom jsp taglibs inside custom FM template tags

Posted by "Benjamin ROYNETTE (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44284#action_44284 ] 

Benjamin ROYNETTE commented on WW-2246:
---------------------------------------

I also encouter this issue. This only happens when adding some custom taglibs inside a Struts2 UI tag under Tomcat 5.5 / 6.0 This works perfectly when using Resin 3 
Using custom tag libraries in a normal freemarker page just works fine under both Tomcat and Resin.

> Impossible to use custom jsp taglibs inside custom FM template tags
> -------------------------------------------------------------------
>
>                 Key: WW-2246
>                 URL: https://issues.apache.org/struts/browse/WW-2246
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>         Environment: Windows OS, J2SE 1.6, J2EE 5, Struts2
>            Reporter: Alexey Koloskov
>             Fix For: 2.1.3
>
>
> I create custom UI tags for Struts2 using FreeMarker. Inside FreeMarker
> template I use custom jsp tags library, e.g. displaytag as follows:
> <#assign display=JspTaglibs["http://displaytag.sf.net/el"]>
> <@display.table name="parameters.entities"/>.
> But during template rendering I get a such error:
> "freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut()
> is null" at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156).
> It seems like a bug because for the first time
> FreeMarkerPageContext.getOut() always return null, and the check if(out !=
> pageContext.getOut()) is always true for JSPWriter.
> Stack trace:
> error when rendering out != pageContext.getOut(). Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> The problematic instruction:
> ----------
> ==> user-directive display.table [on line 4, column 1 in template/xhtml/EntityList.ftl]
> ----------
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156)
> at freemarker.core.Environment.visit(Environment.java:220)
> ...(tale is omitted)

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


[jira] Commented: (WW-2246) Impossible to use custom jsp taglibs inside custom FM template tags

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44446#action_44446 ] 

Musachy Barroso commented on WW-2246:
-------------------------------------

on a second thought, would anything break if we always wrap the writer? I don't quite get what this condition is checking:

 if (bodyContent != null && bodyContent.isAssignableFrom(writer.getClass())) {

> Impossible to use custom jsp taglibs inside custom FM template tags
> -------------------------------------------------------------------
>
>                 Key: WW-2246
>                 URL: https://issues.apache.org/struts/browse/WW-2246
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>         Environment: Windows OS, J2SE 1.6, J2EE 5, Struts2
>            Reporter: Alexey Koloskov
>             Fix For: 2.1.3
>
>
> I create custom UI tags for Struts2 using FreeMarker. Inside FreeMarker
> template I use custom jsp tags library, e.g. displaytag as follows:
> <#assign display=JspTaglibs["http://displaytag.sf.net/el"]>
> <@display.table name="parameters.entities"/>.
> But during template rendering I get a such error:
> "freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut()
> is null" at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156).
> It seems like a bug because for the first time
> FreeMarkerPageContext.getOut() always return null, and the check if(out !=
> pageContext.getOut()) is always true for JSPWriter.
> Stack trace:
> error when rendering out != pageContext.getOut(). Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> The problematic instruction:
> ----------
> ==> user-directive display.table [on line 4, column 1 in template/xhtml/EntityList.ftl]
> ----------
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156)
> at freemarker.core.Environment.visit(Environment.java:220)
> ...(tale is omitted)

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


[jira] Resolved: (WW-2246) Impossible to use custom jsp taglibs inside custom FM template tags

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-2246.
---------------------------------

    Resolution: Fixed

Fixed on trunk in rv718652. The writer passed to FM will always be wrapped. Please test this and let me know if it works.

> Impossible to use custom jsp taglibs inside custom FM template tags
> -------------------------------------------------------------------
>
>                 Key: WW-2246
>                 URL: https://issues.apache.org/struts/browse/WW-2246
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>         Environment: Windows OS, J2SE 1.6, J2EE 5, Struts2
>            Reporter: Alexey Koloskov
>             Fix For: 2.1.3
>
>
> I create custom UI tags for Struts2 using FreeMarker. Inside FreeMarker
> template I use custom jsp tags library, e.g. displaytag as follows:
> <#assign display=JspTaglibs["http://displaytag.sf.net/el"]>
> <@display.table name="parameters.entities"/>.
> But during template rendering I get a such error:
> "freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut()
> is null" at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156).
> It seems like a bug because for the first time
> FreeMarkerPageContext.getOut() always return null, and the check if(out !=
> pageContext.getOut()) is always true for JSPWriter.
> Stack trace:
> error when rendering out != pageContext.getOut(). Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> The problematic instruction:
> ----------
> ==> user-directive display.table [on line 4, column 1 in template/xhtml/EntityList.ftl]
> ----------
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156)
> at freemarker.core.Environment.visit(Environment.java:220)
> ...(tale is omitted)

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


[jira] Commented: (WW-2246) Impossible to use custom jsp taglibs inside custom FM template tags

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44445#action_44445 ] 

Musachy Barroso commented on WW-2246:
-------------------------------------

It seems to me like FM should not throw an exception in this case, as it should use any writer that is there already (it even says that they should use assertions if jdk was >= 1.4). There is a comment for this code in S2:

// the BodyContent JSP writer doesn't like it when FM flushes automatically -- 
// so let's just not do it (it will be flushed eventually anyway)

which makes not want to change it.

> Impossible to use custom jsp taglibs inside custom FM template tags
> -------------------------------------------------------------------
>
>                 Key: WW-2246
>                 URL: https://issues.apache.org/struts/browse/WW-2246
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>         Environment: Windows OS, J2SE 1.6, J2EE 5, Struts2
>            Reporter: Alexey Koloskov
>             Fix For: 2.1.3
>
>
> I create custom UI tags for Struts2 using FreeMarker. Inside FreeMarker
> template I use custom jsp tags library, e.g. displaytag as follows:
> <#assign display=JspTaglibs["http://displaytag.sf.net/el"]>
> <@display.table name="parameters.entities"/>.
> But during template rendering I get a such error:
> "freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut()
> is null" at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156).
> It seems like a bug because for the first time
> FreeMarkerPageContext.getOut() always return null, and the check if(out !=
> pageContext.getOut()) is always true for JSPWriter.
> Stack trace:
> error when rendering out != pageContext.getOut(). Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> The problematic instruction:
> ----------
> ==> user-directive display.table [on line 4, column 1 in template/xhtml/EntityList.ftl]
> ----------
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateModelException: out != pageContext.getOut().
> Out is org.apache.jasper.runtime.JspWriterImpl@173b3fa pageContext.getOut() is null
> at
> freemarker.ext.jsp.TagTransformModel.getWriter(TagTransformModel.java:156)
> at freemarker.core.Environment.visit(Environment.java:220)
> ...(tale is omitted)

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