For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 13 replies, 2 voices, and was last updated 21 years ago by
Knut Erik Ballestad.
-
AuthorPosts
-
Knut Erik BallestadMemberIn some situations the JSP editor does not understand import of a Java type, like e.g:
<%@ page import="my.pkg.Class" %>– the name of the class is underlined in red.
– the class DOES EXIST in the project classpath
– other classes in the same package imports just fineIf I instead of using imports on this class uses fully qualified class name, everything works OK:
my.pkg.Class myInstance = new my.pkg.Class();I am using Eclipse 3.1M6 and MyeclipseIDE 3.8.4beta on Sun JDK 1.5.0, but I have also observed the problem om Eclipse 3.0.1 + Myeclipse 3.8.4 + JDK 1.5.0. I have not tested other configurations.
May 10, 2005 at 12:08 pm #229344
Riyad KallaMemberWell this would certainly be a bug if we can find a reproducable case. I have no run across this before. Is there anything odd about the class? Is it from another project?
May 11, 2005 at 11:34 am #229420
Knut Erik BallestadMember@support-rkalla wrote:
Well this would certainly be a bug if we can find a reproducable case. I have no run across this before. Is there anything odd about the class? Is it from another project?
Well, not exactly anything odd, but here is how it is used in my setting:
– I use an ant script (using middlegen) that reads my database metadata to generate a Hibernate mapping. The generated hibernate source output folder is set up as one out of totally three eclipse source folders for this project. This makes the Java compiler etc recognize the class as expected.
– I use the hibernate objects directly in my web pages. In the JSP editor, the first import statement is not accepted, but all other import statements, including ones importing from the same package works OK.
– If I does a cut – save – paste at another position, the editor still marks the same import in red.If I right-click ‘Myeclipse – Run Validation’, I get this response:
Validation of resource /mywebapp/MyPage.jsp is complete.The only strange thing I can find is that the MyEclipse context meny lists four choices:
- Run Validation
Remove all validation markers
Run Validation
Remove all validation markersMay 11, 2005 at 11:48 am #229421
Riyad KallaMember– I use an ant script (using middlegen) that reads my database metadata to generate a Hibernate mapping. The generated hibernate source output folder is set up as one out of totally three eclipse source folders for this project. This makes the Java compiler etc recognize the class as expected.
Are you manually refreshing your proejct after running your Ant script AND do you have Project > Build Automatically selected? Any external process (almost always Ant scripts) that generate files require the project to be refreshed so the changed files can be recognized by Eclipse, which does not use an automatic polling model like NetBeans to detect changes in the FS.
May 11, 2005 at 12:05 pm #229422
Knut Erik BallestadMemberAre you manually refreshing your proejct after running your Ant script AND do you have Project > Build Automatically selected? Any external process (almost always Ant scripts) that generate files require the project to be refreshed so the changed files can be recognized by Eclipse, which does not use an automatic polling model like NetBeans to detect changes in the FS.
Yes, I refresh my project manually, and build automatically is selected.
The problem does not go away even if I perform a ‘Project – clean’, restarts Eclipse, or both.
May 11, 2005 at 12:09 pm #229423
Riyad KallaMemberIs there anyway you can send me this project? File > Export > To ZIP, support@genuitec.com ATTN Riyad? I really want to figure out what is going on here…
May 11, 2005 at 12:42 pm #229425
Knut Erik BallestadMemberOK, exporting to file system now.
Will zip it up and send it to you ASAP.May 23, 2005 at 11:12 am #230065
Knut Erik BallestadMember@support-rkalla wrote:
Is there anyway you can send me this project? File > Export > To ZIP, support@genuitec.com ATTN Riyad? I really want to figure out what is going on here…
Did you figure out anything from my project contents?
Update:
On Eclipse 3.1M7 + ME3.8.4forM7 I do not get into this problem – but another one has shown it’s face instead 🙂Now I do not get any ‘faulty’ indications of compiler errors, but instead I do not get any compiler error markings at all!
– If i Import a non-existing class, no errors are shown in the JSP editor.May 23, 2005 at 11:28 am #230067
Riyad KallaMemberNow I do not get any ‘faulty’ indications of compiler errors, but instead I do not get any compiler error markings at all!
– If i Import a non-existing class, no errors are shown in the JSP editor.This is a known problem, we will have it fixed in M2.
Did you figure out anything from my project contents?
I tried a few times to login and get the resources and was unable to. I am glad to hear the error was fixed however.
May 25, 2005 at 7:32 am #230121
Knut Erik BallestadMemberStill some strange stuff happening in ME3.8.4 for M7:
E.g. that I have a JSP taglib with a tag that behaves very much like <bean:define in the standard Struts tag library, except that I have added some behaviour of my own.
When Using
<bean:define id="test">ABCDEFGHIJK</bean:define>to define a String variable, and then displaying it’s content like this in the JSP:
test=<%=test%>everything works as expected.
If I define the variable using my taglib
<mytaglib:define id="test" otherParams......>ABCDEFGHIJK</bean:define>to define a String variable it works OK, and my tag code is executed OK
If I then try to display the defined content like this in the JSP:test=<%=test%>I get this error message in the console:
An error occurred at line: 19 in the jsp file: /MyJsp.jsp Generated servlet error: test cannot be resolvedShouldn’t the JSP editor warn me if I try to use variables that cannot be resolved?
Strange2:
<bean:write name="test" scope="page"/>…writes out the variable OK.
The page variable is defined just as inside of Struts bean:define
pageContext.setAttribute("test", "value", PageContext.PAGE_SCOPE);May 25, 2005 at 9:18 am #230130
Riyad KallaMemberShouldn’t the JSP editor warn me if I try to use variables that cannot be resolved?
Yes, this is a known bug with M7 that compiler errors are not being shown.
May 26, 2005 at 10:53 am #230217
Knut Erik BallestadMemberIf I define a bean for use in my JSP page like this:
<jsp:useBean id="myBean class="mypkg.MyClass"/>I can then add JSP code like this:
<% myBean.setValue("abc");and it will work just fine.
The issue is that content assist doesn’t recognize that I have defined an instance of MyClass.
If I instead define the myBean instance like this:<% mypkg.MyClass myBean = new mypkg.MyClass();%>content assist works as expected.
May 26, 2005 at 10:56 am #230218
Riyad KallaMemberCorrect, most autocomplete for beans defined with jsp:useBean are special-case autocomplete that KNOWS that useBean defines a bean, in our case our autocomplete is more general and relies on real-time analysis… consider a taglib like Struts bean taglib, you and I know it does somethign very similar to jsp:useBean, but no IDEs know what it does, so you won’t get autocomplete for it’s beans… same goes for JSTL core tags… basically there is no way to know what a taglib is doing, and we have no put in place the special-case of recognizing the jsp:useBean tag and allowing autocomplete for it, but this is a filed enhancement we may look into in the future.
May 26, 2005 at 5:11 pm #230258
Knut Erik BallestadMember@support-rkalla wrote:
Correct, most autocomplete for beans defined with jsp:useBean are special-case autocomplete that KNOWS that useBean defines a bean, in our case our autocomplete is more general and relies on real-time analysis… consider a taglib like Struts bean taglib, you and I know it does somethign very similar to jsp:useBean, but no IDEs know what it does, so you won’t get autocomplete for it’s beans… same goes for JSTL core tags… basically there is no way to know what a taglib is doing, and we have no put in place the special-case of recognizing the jsp:useBean tag and allowing autocomplete for it, but this is a filed enhancement we may look into in the future.
OK, but couldn’t you just “behind the scenes” insert the actual java code that the taglib consists of, and base the autocomplete functionality on that?
– This would at least work for all taglibs that you have source code for, which for most proactical purposes would be more than good enough.
I guess you wouldn’t even need the source code, as long as the java classes are compiled with debug info in them, to achieve this?
-
AuthorPosts
