This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I am creating a web framework with a servlet controller:
I go the idea to forward with RequestDispatcher from "Foundations of JSP Design Patterns". My problem is that my controller is returning "jsp/welcome.jsp" but then the request comes back to the servelet; my web.xml is:
Do I have to do something in web.xml?
Your help will be greatly appreciated,
Thank you Bear Bibeault. I apologize for not being clear. The line: String view = controller.execute(request, response); returns "/jsp/welcome.jsp" which is the page I want to return to the browser. The problem is that forwarding with the RequestDispatcher, the browser is not getting the JSP; what is happening is that the servelet controller is being invoked again and the program is back in the doPost method. What i am trying to achieve is sending to the browser the result of processing the JSP.
This says "send every request to my servlet". Every request. Every one. Even for images. Even for stylesheets. Even for HTML. And even for JSPs.
Change it to something like /action/* so that only URL's prefixed with /action/ go to the servlet.
Joined: Aug 01, 2005
Yes, the idea is to find a way that the servlet is not called when the URL ends in ".jsp". Actually, The URL I am using is "http://localhost:8080/Front Controller/LoginController" because the web application is called "Front Controller"; if I use <url-pattern>/action/*</url-pattern> I get a 404 error. However It works with <url-pattern>/</url-pattern>.
Now I have a simple web framework; the controllers get the data from the request and the JSPs are populated with JSTL>