You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/10/26 21:31:58 UTC

[Bug 58554] New: Cannot output html from jsp files inside of lambdas

https://bz.apache.org/bugzilla/show_bug.cgi?id=58554

            Bug ID: 58554
           Summary: Cannot output html from jsp files inside of lambdas
           Product: Tomcat 8
           Version: 8.0.26
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: joseph.lenton@askattest.com

If you use a within a JSP file, and you output html within that lambda, then
you receive a compile error.

This is because the HTML is outputted using a variable 'out' which is not
final. So the 'out' variable in the generated JSP code needs to be changed to
be final.

i.e.

<%
    // stuff like this fails to compile
    blog.eachPost( (title, content) -> { %>
        <h1><%= title %></h1>
        <p><%= content %></p>
    %> });
%>

It would be useful if lambdas could work in JSP files.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 58554] Cannot output html from jsp files inside of lambdas

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58554

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
There is nothing I could find in the JSP specification that states that the
implicit variables are final.

The current JSP code generation is clearly written on the basis that they are
not final and that they may change during the execution of the JSP page.

As an aside, the example in the description wouldn't work even if out were
final due to the IOExceptions thrown. A try/catch block is also required.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 58554] Cannot output html from jsp files inside of lambdas

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58554

--- Comment #4 from Joseph Lenton <jo...@askattest.com> ---
> As an aside, the example in the description wouldn't work even if out were final due to the IOExceptions thrown. A try/catch block is also required.

If you add 'throws IOException' on the appropriate methods then the example
should compile.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 58554] Cannot output html from jsp files inside of lambdas

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58554

--- Comment #1 from Christopher Schultz <ch...@christopherschultz.net> ---
Should this usage of request.getContentLength be changed to use
request.getHeader("Content-Length") to avoid the 2GiB primitive int limit?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 58554] Cannot output html from jsp files inside of lambdas

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58554

--- Comment #2 from Christopher Schultz <ch...@christopherschultz.net> ---
Obviously, comment #1 was attached to the wrong bug. Apologies for the noise.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org