If the urlPatterns
controls basic URL rewrite, can I not use .htaccess
to rewrite the URL? I'm looking at this code: http://www.objectdb.com/tutorial/jpa/eclipse/ee/servlet
...
@WebServlet(name = "GuestServlet", urlPatterns = {"/guest"})
public class GuestServlet extends HttpServlet {
...
This page works great when I access http://localhost:8080/Guestbook/guest
, but what if I wanted to do http://localhost:8080/Guestbook/guest/edit?id=4
, how would I set that up in this controller?
In PHP the logical steps would be http://localhost:8080/Guestbook/controller/function
. In java it seems like I can only use doGet()
, is this right?
I'm trying to envision how the overall URL structure affects the execution of controllers.