- This topic has 8 replies, 2 voices, and was last updated 19 years, 5 months ago by garand.
-
AuthorPosts
-
garandMemberin a JSP, I use a static method of an object and the validator tells me that a class type is missing.
The message is : cannot access to com.lodh.AActivitySpace
I guess that validator make the check on the second static method instead of the first one. Can you help me ?
==============================================
The jsp code :
==============================================<%
IRemoteSession rs = new IRemoteSession();
ObjectClass cl = new ObjectClass();
int id = getObjectIdByName(IRemoteSession se, String strName, ObjectClass classObj);
%>==============================================
The class wich make problem :
==============================================public class DatabaseHelper
{
public static int getObjectIdByName(IRemoteSession se, String strName, ObjectClass classObj)
{
…
}
public static int getObjectIdByName(AActivitySpace as, String strName, int iClassId)
{
…
}
Riyad KallaMemberWhy isn’t your code:
int id = DatabaseHelper.getObjectIdByName(IRemoteSession se, String strName, ObjectClass classObj);If you are using static imports (Java 5) then make sure that the “javac.exe” executable you have in your system path is from your JDK 1.5 install and not your JDK 1.4 install.
garandMemberI’m sorry,
I made a bad copy/paste in my explanation. Of course, in the jsp, the code is :
<%
IRemoteSession rs = new IRemoteSession();
ObjectClass cl = new ObjectClass();
int id = getObjectIdByName(rs, “test”, cl);
%>
Riyad KallaMemberYou just copy and pasted the same line:
int id = getObjectIdByName(rs, “test”, cl);
so I still have the same advice for you 🙂
garandMemberNo, it is not the same line. First time I put the classname of the parameters inside the code. And in fact, I also forget to add the static class before the name of the called method.
my calling code is :
int id = DatabaseHelper.getObjectIdByName(rs, “test”, cl);
Also, I don’t use JDK 5.0.
Riyad KallaMemberIs the DatabaseHelper class imported in an @page import statement at the top of the file? If it is, try and remove it, and then autocomplete the class again so the editor re-inserts the import for you. You may have refactored the package name of the class.
garandMemberI tried your advice but it doesn’t work. There is as strange thing, nevertheless :
if I write
int id = DatabaseHelper.getObjectIdByName(rs, "test", cl); int id2 = DatabaseHelper.getObjectIdByName(rs, "test", cl);
The first line is found as incorrect but not the second one !
Riyad KallaMembergarand can you export this project and send it to me? If not the whole project, then create a separate sample project that has the JSPs and all classes such that it compiles without errors AND exhibits the problem. Then email it to [email protected] ATTN Riyad
garandMemberHi Riyad,
I found the problem and I solved it :
In my jsp, I only use the DataBaseHelper.getObjectIdByName(IRemoteSession se, String strName, ObjectClass classObj) method.
Nevertheless, as the method DataBaseHelper.getObjectIdByName(AActivitySpace as, String strName, int iClassId) exists, the jsp validator want to know the classes parameters of this second method.
So, I added an import to the AActivitySpace class in my jsp and then, the validator agree my jsp. It’s strange but it runs.
Thanks for your help.
Vincent -
AuthorPosts