facebook

Problem with Code Completion in JSPs

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #206654 Reply

    Norbert Haar
    Member

    Hi there,

    i have a problem with code completion in JSPs.
    I’ve searched under FAQs, found some postings with same problems, but could rule out the same reasons in my case.

    So, here is a short piece of code:
    <%– start of file –%>
    <%
    String test = “1234”;
    test.<completion works fine!!!!>
    %>
    <jsp:useBean id=”loginForm” class=”com.xxx.yyy.PasswordForm” scope=”request”/>
    <%
    String test = “1234”;
    test.<nothing happens 🙁 >
    %>

    I’m working under NT4, Eclipse 2.1.1, MyEclipse 2.7.1
    The files are under root, not write protected, rebuilding project runs successfully…

    Do you have an idea?

    Regards Norbert

    #206658

    Riyad Kalla
    Member

    Robert,
    The code snippet above should actually give you a compile exception as you’ve defined the ‘test’ variable twice… in a Java class file this would effectively be:

    
    String test = "hi";
    String test = "banana"; // <-- Compiler error
    

    If there are errors in the JSP file, the editor’s autocomplete is VERY sensative. We are working on improving it, but in this case, commenting out your 2nd “String test =”1234″” and then trying autocomplete again should work.

    Also, make sure you are using the newest MyEclipse release for your respective version of Eclipse, the JSP editor gets better every release.

    #206691

    Norbert Haar
    Member

    Hi Riyad,

    Ok, you’re right (copy and paste error 😉 ) but the core of problem is still maintained: behind the first <jsp:..> tag, code completion does not work.
    Please try this:
    ———————————————
    <%
    String test = “1234”;
    test.<completion works fine!!!!>
    %>
    <jsp:useBean id=”loginForm” class=”com.xxx.yyy.PasswordForm” scope=”request”/>
    <%
    test.<code completion does not work>
    %>

    I,ve downloaded MyEclipse before 5 Weeks (and registered last week :-), so I don’t think that this is a version problem.
    Version = 2.7.1, Build 200403241200-2.7.1-GA
    JDK = 1.4.2_01, Eclipse = 2.1.1 Build 200306271545

    Does the short code snippet works on your environment with code completion?

    Regards Norbert

    #206693

    Riyad Kalla
    Member

    Norbert,
    As I mentioned before, if there is an error in your JSP page, completion most likely won’t work. In your case, your jsp:useBean line has an error because the class you specified does not exist. If you change your “class=” to “java.lang.String”, you’ll find that autocomplete works fine on the next line.

    I’m wondering if you don’t have validation turned on for JSP pages, or else you should be seeing error markers in the gutter of the editor. Make sure you have the follow 2 options turn on:
    Window > Preferences > Workbench > Perform build automatically on resource modification
    and
    Window > Preferneces > MyEclipse > Editors > JSP/HTML Editor > “Compile JSPs”

    Now when you save your JSP, errors should be marked immediately for you.

    #206714

    Norbert Haar
    Member

    Hi Riyad,

    when changing the useBean tag class to “java.lang.String”, Code Completion works. Also the use of self written classes, located in jar files in the build path, works fine
    The “Compile JSP” Flag is on, “Build automatically” also.
    But <jsp:useBean> with a class that really not exists, does not force a compile error.
    My Application runs fine, all classes can be accessed, there’re no errors.
    The most used classes in <jsp:useBean> are project related classes, still not bound to a jar file.
    The compiled classes are under the default folder “myProject/WEB-INF/classes” in the “webapps” directory under Tomcat.
    So I’ve not to build a Jar/War/Ear file for testing.
    Maybe a path variable is missing? But compilation works fine.

    The include directive <%@ include file=”main_include.jsp” %> also causes not working code completion.

    Norbert

    #206719

    Riyad Kalla
    Member

    when changing the useBean tag class to “java.lang.String”, Code Completion works. Also the use of self written classes, located in jar files in the build path, works fine

    Glad to hear it.

    But <jsp:useBean> with a class that really not exists, does not force a compile error.

    *scratching head* So if you change the class to equal something like “I.Like.Ham”, and save it, you don’t get a compiler error?

    The most used classes in <jsp:useBean> are project related classes, still not bound to a jar file.
    The compiled classes are under the default folder “myProject/WEB-INF/classes” in the “webapps” directory under Tomcat.
    So I’ve not to build a Jar/War/Ear file for testing.
    Maybe a path variable is missing? But compilation works fine.

    I didn’t understand what you are trying to say here… can you explain in more detail if you are asking a question, and if so, what it is? I didn’t get if you were explaining your setup or trying to ask why something wasn’t quite working right…

    The include directive <%@ include file=”main_include.jsp” %> also causes not working code completion.

    I was not able to reproduce this problem locally, lets try and fix your other problems first and come back to this.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Problem with Code Completion in JSPs

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