Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

JSP and Servlets compile error

Options
  • 11-11-2003 6:52pm
    #1
    Registered Users Posts: 4,222 ✭✭✭


    sorry, this is a bit long winded but i'm just after moving from doing webapps in ASP and vbscript\javascript to jsp and servlets :)

    Can jsp not compile a web project correctly it there are duplicate file names but in different directories?

    trying to compile a project using the NetBeans IDE.

    Have 2 folders and some of the file in one directory have the same name as in the other directory.
    The reason for this was so as not to have to do a shed load of client side checks to check which controls and pages you have access to and to display but to have that all done on by the servlets simple by checking a session variable that is set when you log in and direct ye the the appropiate page.

    the idea was for example:
    2 folders : siteAdmin and customer
    file(s) in each folder with a duplicate name e.g. ShowMessages.jsp

    when ye log in the dipsatcher servlet would direct you to the correct version of the file simply by checking the page req (ShowMessages.jsp) and then based on the role, prepend the url with either "siteAdmin/" or "customer/"

    However when compiling this type of scenario the compiler throws the following type of error:
    "ShowMessages$jsp.java [9:1] duplicate class: org.apache.jsp.ShowMessages$jsp
    public class ShowMessages$jsp extends HttpJspBase {
    "

    So can it be done or will i just have to bite the bullet and put in all the client side checks to build up the web page display?
    if not can ye explain why not?

    Ta muchly.


Comments

  • Registered Users Posts: 1,994 ✭✭✭lynchie


    What are you running your JSPs under? Tomcat? I know that tomcat will prepend the directory structure of the webapp leading up to the jsp file before compiling it so that two jsp's with the same name but in different directories are compiled in different packages to prevent name clashes.


  • Registered Users Posts: 4,222 ✭✭✭Scruff


    Compiling is done by the NetBeans IDE. Its got an internal version of Tomcat 4.0.6. Doesnt seem to be doing as you say though. It throws the error and doesnt build the war file.


  • Registered Users Posts: 1,994 ✭✭✭lynchie


    Run a standalone copy of tomcat, stick two files with the same name in different directories into the webapp and see if tomcat complains. It shouldn't. This will suggest that the configuration of tomcat in netbeans is screwed up or not configured correctly. I suggest you post a reply on the netbeans list or sun's java forums if this is the case.


  • Posts: 3,621 ✭✭✭ [Deleted User]


    I have a feeling when the jsps are complied to servlets they are both ending up in the same place. Do you really need two jsps that basicly do the same thing? Maybe have a Jsp:forward statement or jsp:include to acomplish the same thing


Advertisement