Reputation: 99
So I decided to rename my servlets by refactoring them but for some reason something in the project isn't changing the references to those servlets and sticking to the old names instead. I could do a workaround but thats not really solving the problem I have with this.
I've renamed one servlet name from LoginPage to Login however if I try to reference it like so.
request.getRequestDispatcher("/Login").forward(request, response);
The application will simply say it has no where to go but if I use it's old name.
request.getRequestDispatcher("/LoginPage").forward(request, response);
It works like a charm. I've tried to clean and build my project but I just get this error any time I attempt it.
error: option -Xbootclasspath/p: not allowed with target 14 BUILD FAILED (total time: 0 seconds)
Any insight would be appreciated.
Upvotes: 0
Views: 225
Reputation: 99
So I asked my teacher about this today and it turns out when you refactor a servlet it doesn't automatically change it's name and url pattern within the java servlet. Right after all your package imports you should find a line of code that looks like this in the java servlet.
@WebServlet(name = "Login", urlPatterns = {"/Login"})
Simply change name and the urlPatterns value to the new name you refactored to and it should work like a charm.
Upvotes: 1