Hi guys,
I am having a weird problem here, and I am really stuck, need to get this work badly.
so i have a page say index.jsp with a link say "a href=servlet?action=viewMenu". when I click on this link it will go to doGet() on my servlet and here is the code in my servlet.
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
if(action.equals("viewMenu")){
address = "/viewAdminMenu.jsp";
}
RequestDispatcher dispatcher = request.getRequestDispatcher(address);
dispatcher.forward(request,response);
}
So the above code works fine but after request forwarding, my browser shows the url as
localhost/project/servlet?action=viewMenu. (with http:// in the beginning)
I don't want the above url as I could not set the basic authentication with tomcat, what I need is
localhost/project/viewAdminMenu.jsp (with http:// in the beginning)
I have tried to find information about this but haven't been able to figure it out.
Any help will be very much appreciated.