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.
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.
Created attachment 53162 [details] Sample freeform project with a JSP and a JSPF
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.
Fixed. Now when generating a simplified servlet for the currently edited file the JSP expressions in included files are ignored. Checking in SimplifiedJSPServlet.java; /cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/SimplifiedJSPServlet.java,v <-- SimplifiedJSPServlet.java new revision: 1.36; previous revision: 1.35
Created attachment 53187 [details] Fix diff
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.
Should this issue be fixed in a patch for the update center? It was mentioned in the NB 6.0 NetCat acceptance feedback: http://qa.netbeans.org/processes/cat/60/results/editor_comments.html
Reporter, can you verify the fix in the latest trunk build? Thanks, Petr
It works in the 20071129 trunk, many thanks for you efforts.
Marking as verified. Thanks
The fix has been ported into the release60_fixes branch. Checking in SimplifiedJSPServlet.java; /cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/SimplifiedJSPServlet.java,v <-- SimplifiedJSPServlet.java new revision: 1.34.2.1.2.1; previous revision: 1.34.2.1 done
*** Issue 123375 has been marked as a duplicate of this issue. ***
THIS ISSUE STILL EXISTS IN NETBEANS 6.5
Lisa can you please provide a test case? The situation is probably different from the original scenario.
I am soooooooooo sorry guys, I just realized I had 2 includes and that was causing the problem. Issue is solved. Sorry again!!
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.
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.
Martin, can you please investigate? Thanks.
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: http://wiki.netbeans.org/FaqLogMessagesFile And detailed steps how do you get to such troubles? Thanks a lot...
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...
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...
Hi, I also have this problem, and I can provide a very simple test case : Create 3 files : test.jsp test-a.jsp test-b.jsp 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> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <% int i = 0; %> <% if(i == 0) { %> <%@include file="test-a.jsp" %> <% } %> <% else { %> <%@include file="test-b.jsp" %> <% } %> </body> </html> Netbeans (I have 7.4) print the error, saying the variable "test" has already been defined.
It looks that the orginal fix was removed.
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.
Sorry, final changeset is web-main #dd3b731c7699.
Integrated into 'main-silver', will be available in build *201407250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/dd3b731c7699 User: Martin Fousek <marfous@netbeans.org> Log: #122214 - "expr1 is already defined in mergedScriptlets" error when JSP has an include file