facebook

JSP "DUPLICATE LOCAL VARIABLE ERROR"

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #255642 Reply

    Goekhan
    Member

    I have seen a few posts about this error but it does not seem to be definitely resolved.

    I imported a Web project from Eclipse 3.1/MyEclipse 4.1.0 into Eclipse 3.2/MyEclipse 5.0 Milestone 2 and some JSP files started to give “Duplicate local variable” error.

    Duplicate local variable anySession.

    There is no other JSP page being included in the problematic jsp page and “anySession” variable is not defined elsewhere in the page.

    For testing purposes, I renamed anySession to anySession2, anySession3 etc. and rebuilt the project but to no avail.

    I am using Windows XP.

    Can you please help?

    Thanks,

    Goekhan

    #255644 Reply

    Goekhan
    Member

    I just have realized that the JSP scriplets which are giving the error are enclosed by HTML comment tags:

    <!–
    <%
    Enumeration names = null;
    String name = null;
    String[] values = null;
    Enumeration valuesEnum = null;
    %>
    –>

    In previous versions, Eclipce(MyEclipse) used not to complain about this but now it is appearantly being flagged as an error.

    #255647 Reply

    Riyad Kalla
    Member

    Can you post an example of a JSP page I can copy/paste on my end over here to reproduce the problem?

    #255749 Reply

    gabelma1
    Member

    I’m seeing this problem too with my fresh install of Eclipse 3.2 and MyEclipse 5.0M2. The following JSP is sufficient to reproduce the error, giving “Error: Duplicate local variable i” and “Warning: The assignment to variable i has no effect”.

    <!-- <% int i = 0; %> -->
    #255752 Reply

    Riyad Kalla
    Member

    I reproduced this easily, I will file it for investigation.

    #255907 Reply

    Goekhan
    Member

    Is there any news on this issue?

    #255934 Reply

    Riyad Kalla
    Member

    No update, our window for 5.0 release was too small to get this in. I had a developer investigate it very quickly and he didn’t see anything obvious. Management said if it didn’t make it in last minute into 5.0, it would go into the next service release. Sorry about that, my suggested workaround would be using server side comments or just don’t comment your scriptlets. (not the best, but a workaround)

    #264788 Reply

    plthomas
    Member

    @support-rkalla wrote:

    Sorry about that, my suggested workaround would be using server side comments or just don’t comment your scriptlets. (not the best, but a workaround)

    Unfortunately, I have a situation where I have to embed scriptlet inside JavaScript — and JavaScript is always inside an HTML comment, not an server side comment.

    Any progress on this issue?

    #264831 Reply

    Riyad Kalla
    Member

    Not at this time unfortunately.

    #264842 Reply

    plthomas
    Member

    Found an easy work-around…move the variable declarations outside the HTML comments. Only declarations in HTML comments hit this bug.

    #264847 Reply

    Riyad Kalla
    Member

    Ahh very cool, thanks for posting that for other folks.

    #312522 Reply

    Yea that worked for me

    its gotta be outside those html brackets

Viewing 12 posts - 1 through 12 (of 12 total)
Reply To: JSP "DUPLICATE LOCAL VARIABLE ERROR"

You must be logged in to post in the forum log in