- This topic has 9 replies, 3 voices, and was last updated 18 years, 11 months ago by Brian Fernandes.
-
AuthorPosts
-
cyberrajaMemberI am developing a web-project as per your tutorial. I have created the HelloWorld.java class. When I create a new JSP page, and press Ctrl+space in the JSP editor I do not see the HelloWorld class when I press “H” as shown in your flash tutorial.
I just downloaded the new MyEclipse 4.1 M2.
thanks
Scott AndersonParticipantWhen I create a new JSP page, and press Ctrl+space in the JSP editor I do not see the HelloWorld class when I press “H” as shown in your flash tutorial.
The problem is likely that your page hasn’t imported the Java class for use. Only classes in java.lang.* are shown by default. For others you need to include a page directive to import the classes you need to reference. Once the import is in place, code assist will work for that class(es).
cyberrajaMemberThe demo tutorial has an item, that states that MyEclipse will automatically insert the import page directive once I select the class of my choice.
I was expecting the class to appear as in the tutorial and hoping it to paste the import statement automatically, as in the flash tutorial.
Brian FernandesModeratorcyberraja,
Where are you invoking content assist? Are you invoking it within the <% %> tags? If you invoke it from within the HTML portions, you won’t see any assist.
Also note that you cannot import classes that exist in the default package. Is your HelloWorld class in the default package?
Move your class to a package and Auto import should work for you.Let us know if you experience further issues,
Best,
Brian.
cyberrajaMemberYes, I am coding in the <% %> brackets for JSP-java code. I tried both ways. Even after putting the statment on top <%@ page import=”com.pge.test.*” %>, when I press Ctrl+Space I do not see the HelloWorld class.
As per the demo I should not have to specify import statement, and eclipse would insert even that on its own. Am I missing some setting…..I am following the flash web development tutorial step by step. Nothing fancy.
Thank you much for your time.
Brian FernandesModeratorcyberraja,
Sanity check: Does Ctrl + Space in the Standard Java editor get you autocomplete?
Just wondering if you’re using Emacs keybindings for Eclipse, in which case you need to type Alt + /.Further questions:
Import the helloworld class manually – use <%@ page import = “com.pge.test.HelloWorld” %>
now within the <% %> sections, type thisHelloWorld hw = new HelloWorld(); hw.
When you enter the period after hw on the second line, do you get a popup with method suggestions?
Are you using a full fledged JDK or a JRE?
Finally, please have a look at your error log and post the other information requested here: Posting GuidelinesBest,
Brian.
cyberrajaMemberThank you Brian et. al. for all the help.
I tried your tips below and it works now. Only after explicity using “<%@ page import = “com.pge.test.HelloWorld” %> “. Now when I do hw. , I get the auto complete methods of the class.
I am using the full JDK.Would I have to explicitly specify the full import for each class? I would like to use the way it works in the tutorial i.e automatic pastinc of import statement. That looks so cool.
I appreciate your great product and website.
Following is the configuration. Sorry about not reading the posting instructions before.
NOTE:: I went back and installed the MyEclipse 4.0.x instead of the latest M2 release, I was hoping that would fix the problem.
*************************************************
*** Date: Sat Dec 24 10:48:48 PST 2005*** System properties:
OS=Windows2000
OS version=5.0
Java version=1.4.2_04*** MyEclipse details:
MyEclipse Enterprise WorkbenchVersion: 4.0.3 GA
Build id: 20051025-4.0.3-GA*** Eclipse details:
Eclipse SDKVersion: 3.1.1
Build id: M20050929-0840Eclipse Platform
Version: 3.1.1
Build id: M20050929-0840Eclipse RCP
Version: 3.1.1
Build id: M20050929-0840Eclipse Java Development Tools
Version: 3.1.1
Build id: M20050929-0840Eclipse Plug-in Development Environment
Version: 3.1.1
Build id: M20050929-0840Eclipse Project SDK
Version: 3.1.1
Build id: M20050929-0840Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-launcher
C:\Program Files\eclipse\eclipse.exe
-name
Eclipse
-showsplash
600
-exitdata
574_44
-vm
C:\j2sdk1.4.2_04\bin\javaw.exe********************************************
Brian FernandesModeratorCyberraja,
Thank you for the compliments. I only asked you to do the import to see if all was well with your project and your class was in the expected location – everything looks fine.
You should not have to explicitly specify the import for each class, that is indeed supposed to happen automatically after invoking content assist for a class not already imported.If you remove your all your import directives in the jsp (though not necessary) and within the <% %> tags, you type “Hel” and then press either C + S or A + / – nothing happens?
Could you check your error log for details please (see Posting guidlines for instructions) – also, can you confirm that pressing C + S does give you autocomplete in the Java editor?
Or in the HTML portions of the document, are you prompted with tag names when you press that key combination?Best,
Brian.
cyberrajaMemberAfter removing import directives. When I type “Hel” in the <% %> tags and press C + S, that does the trick, it shows the HelloWorld class and pastes the import statement 🙂
In retrospect. I was expecting that without typing “Hel” when I press C + S on a page within scripts, I would see all my custom classes in the current project list.
Now I know how this works.
You guys rock.
Brian FernandesModeratorGlad it’s working for you now and thanks again for the compliment 🙂
Best,
Brian. -
AuthorPosts