Community
Participate
Working Groups
Steps to reproduce: 1. Create a WEB 3.0 project (either with or without a DD) 2. Create a JSP page in the web project 3. Create a class in the web project that extends javax.servlet.http.HttpServlet 4. Open the new servlet wizard 5. Select the "Use an existing Servlet class or JSP" option, click the browse button, and select the JSP file. 6. Finish the wizard (PROBLEM: The JSP file is opened, but nothing else happens) 7. Repeat steps 4-6, but now selecting the class instead of the JSP file ((PROBLEM: The class file is opened, but nothing else happens)
There are two problems that I found here: 1) The Browse button in step 5 gives an error if there are only JSPs in the Web project. (This goes for all Java EE versions) 2) For any Servlet/Filter/Listener, if useExisting is selected, then we should ensure that the deployment descriptor is generated and the proper values are set. The reason for this is that an annotated Servlet/Filter/Listener (or one already in the DD) would show an error and Finish would be disabled, thus the only case where useExisting would be true would be in the case of a non-annotated class file or a JSP (which cannot be annotated) being added, and thus the deployment descriptor should be updated.
For explanatory purposes, in debugging I noticed that the extensions are being set twice and a TypedFileViewerFilter with the exact same extensions are being added twice - once in the constructor for FilteredFileSelectionDialog, and again in the constructor for MultiSelectFilteredFileSelectionDialog. I removed the ones from MultiSelectFilteredFileSelectionDialog. I also modified the code to call setMessage only if the message passed in is null - if it is not null, setMessage is called by FilteredFileSelectionDialog (and then it was called again with exactly the same value). I modified open() so that if there are no Servlets but are JSPs, the JSP radio button is selected (and the dialog still opens... previously, it would not open). I also had to capture the contents of setInput(), since its superclass keeps it private, and I needed it to determine if there were any JSP files.
Created attachment 178895 [details] The aforementioned changes
Kaloyan - I added you in the CC because of fix #2 in comment #1 . I believe that is the correct fix to make, as per my logic, but wanted to make sure that your team agrees. Marking for Chuck's review for inclusion in WTP 3.2.3 (once that opens up).
Carl, by "annotated" do you mean XDoclet annotation or Servlet 3.0 annotations?
approve
Kaloyan, I am referring to both types of annotations. However, the XDoclet code will regenerate the web.xml entries for XDoclet servlets whenever a build is done. Therefore, for both annotation scenarios, useExisting should be false, and thus the logic should be correct.
Committed to HEAD for WTP 3.3. Once WTP 3.2.3 opens up, I will commit it there. (Unless testing in HEAD encounters a scenario in which this is not correct.)
Committed to R3_2_maintenance for WTP 3.2.3