This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 122214 - "expr1 is already defined in mergedScriptlets" error when JSP has an include file
Summary: "expr1 is already defined in mergedScriptlets" error when JSP has an include ...
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 7.2.1
Hardware: PC Windows 7
: P2 blocker (vote)
Assignee: Martin Fousek
: 123375 (view as bug list)
Depends on:
Reported: 2007-11-17 17:52 UTC by marczi
Modified: 2014-07-25 02:36 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Sample freeform project with a JSP and a JSPF (3.09 KB, application/octet-stream)
2007-11-17 17:53 UTC, marczi
Fix diff (2.12 KB, text/plain)
2007-11-19 10:11 UTC, Tomasz Slota

Note You need to log in before you can comment on or make changes to this bug.
Description marczi 2007-11-17 17:52:09 UTC
I've a web project where every JSP uses @include file="..." to include a common menu. In both NB 6.0rc1 and daily
snapshot  the JSP scriptlet editor show an error with the following description: "expr1 is already defined in
mergedScriptlets". This bug appears only when both the JSP and the included JSPF contains an <%= ... %> expression. I've
created and attached a very simple, stripped-down version of the project that shows this bug. For simplicity,
expressions are plain numbers.
Comment 1 marczi 2007-11-17 17:53:28 UTC
Created attachment 53162 [details]
Sample freeform project with a JSP and a JSPF
Comment 2 Tomasz Slota 2007-11-19 09:41:19 UTC
Reproducible when the including page as well as the page being included contain at least one <%= ... %> expression each. Upgrading to P2, we might 
consider increasing the priority even more so that it gets fixed for 6.0.

The fix should be easy and of low risk. 
Comment 3 Tomasz Slota 2007-11-19 10:09:00 UTC
Fixed. Now when generating a simplified servlet for the currently edited file the JSP expressions in included files are ignored. 

Checking in;
/cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/,v  <--
new revision: 1.36; previous revision: 1.35
Comment 4 Tomasz Slota 2007-11-19 10:11:03 UTC
Created attachment 53187 [details]
Fix diff
Comment 5 David Konecny 2007-11-19 16:18:00 UTC
I reviewed the fix. All scriptlet expressions from included JSPs are ignored and are not part of generated Java file. If
there is for example compilation error in one of the expressions user will not be notified. It was explained to me that
it is no needed and in such a case this fix is correct and works fine.
Comment 6 Petr Jiricka 2007-11-29 12:48:23 UTC
Should this issue be fixed in a patch for the update center? It was mentioned in the NB 6.0 NetCat acceptance feedback:
Comment 7 Petr Blaha 2007-11-29 14:35:20 UTC
Reporter, can you verify the fix in the latest trunk build? Thanks, Petr
Comment 8 marczi 2007-11-30 08:00:01 UTC
It works in the 20071129 trunk, many thanks for you efforts.
Comment 9 Petr Blaha 2007-11-30 11:06:35 UTC
Marking as verified. Thanks
Comment 10 pgebauer 2007-12-03 14:43:07 UTC
The fix has been ported into the release60_fixes branch.

Checking in;
/cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/,v  <--
new revision:; previous revision:
Comment 11 Tomasz Slota 2007-12-05 08:52:06 UTC
*** Issue 123375 has been marked as a duplicate of this issue. ***
Comment 12 lisadesouza89 2009-04-28 14:56:26 UTC
Comment 13 Tomasz Slota 2009-04-28 15:51:23 UTC
Lisa can you please provide a test case? The situation is probably different from the original scenario.
Comment 14 lisadesouza89 2009-04-29 07:17:10 UTC
I am soooooooooo sorry guys, I just realized I had 2 includes and that was causing the problem. Issue is solved. Sorry
Comment 15 Tomasz Slota 2009-04-29 08:54:38 UTC
Well in such case there would be still a problem in NetBeans - it should give a more meaningful warning. However I could not reproduce this situation. It 
would be great if you could file another issue and describe the steps to reproduce it.
Comment 16 tamermarzouk 2012-12-03 16:56:04 UTC
I have a jsp page that has @taglib uri jsp directive set to "/WEB-INF/tlds/displaytag.tld"

I had to comment that taglib in order to use code completition as it does not work with this taglib defined. When I finished editing, I uncommented the taglib directive again to find a strange error saying "variable exp1 is already defined in method mergedScriptlets(HttpServletRequest, ..." 

I tried renaming the variable to diferent name with no luck, same error is displayed.
Comment 17 Petr Jiricka 2012-12-04 10:03:50 UTC
Martin, can you please investigate? Thanks.
Comment 18 Martin Fousek 2012-12-04 15:09:02 UTC
tamermarzouk please could you provide more information how to reproduce your issue? I have project with the @taglib directive. CC works to me for the prefix I choose for given tag library, and also when I comment/uncomment that taglib definition, no error is displayed.

Please could you provide your message.log:

And detailed steps how do you get to such troubles?

Thanks a lot...
Comment 19 Martin Fousek 2012-12-07 13:48:15 UTC
tamermarzouk please could you provide information requested in the comment #18? We need more information to be able to detect issue you are facing. Thanks...
Comment 20 Martin Fousek 2012-12-10 08:52:54 UTC
I have to close this issue as incomplete for now. I don't have needed information to be able to reproduce this issue. It works well to me. Reporter please could you attach information requested in comment #18?

At least messages.log and some steps for reproducing this issue would be necessary. Thanks a lot...
Comment 21 tautin 2014-03-18 15:04:42 UTC
I also have this problem, and I can provide a very simple test case :
Create 3 files :

In test-a.jsp and test-b.jsp, juste write this :
<% String test = "test"; %>

And in test.jsp write this :

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        int i = 0;
        <% if(i == 0) { %>
        <%@include file="test-a.jsp" %>
        <% } %>
        <% else { %>
        <%@include file="test-b.jsp" %>
        <% } %>

Netbeans (I have 7.4) print the error, saying the variable "test" has already been defined.
Comment 22 Martin Fousek 2014-07-22 07:27:08 UTC
It looks that the orginal fix was removed.
Comment 23 Martin Fousek 2014-07-22 12:50:21 UTC
The philosophy of the new fix is different. I'm including file content into places where they are really included. The previous behaviour was to include all files content at the beginning of the generated .java class which led to such issues.

But hard to guess whether it could cause regression since I don't know the area deeply. All test cases I have - original report, the last described case and original issue against included JSPs (bug #157782) - works well to me know.

Fixed in web-main #575832c2113d.
Comment 24 Martin Fousek 2014-07-23 06:17:20 UTC
Sorry, final changeset is web-main #dd3b731c7699.
Comment 25 Quality Engineering 2014-07-25 02:36:50 UTC
Integrated into 'main-silver', will be available in build *201407250001* on (upload may still be in progress)

User: Martin Fousek <>
Log: #122214 - "expr1 is already defined in mergedScriptlets" error when JSP has an include file