facebook

jsp validator : does not recognize overloaded methods

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

    garand
    Member

    in 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)
    {

    }

    #232473 Reply

    Riyad Kalla
    Member

    Why 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.

    #232484 Reply

    garand
    Member

    I’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);
    %>

    #232492 Reply

    Riyad Kalla
    Member

    You just copy and pasted the same line:

    int id = getObjectIdByName(rs, “test”, cl);

    so I still have the same advice for you 🙂

    #232684 Reply

    garand
    Member

    No, 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.

    #232687 Reply

    Riyad Kalla
    Member

    Is 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.

    #232774 Reply

    garand
    Member

    I 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 !

    #232790 Reply

    Riyad Kalla
    Member

    garand 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

    #232855 Reply

    garand
    Member

    Hi 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

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: jsp validator : does not recognize overloaded methods

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