Say I have a jsp page with something like this in it: <% String page1 = null; page1 = request.getParameter("page"); if (page1.equals("null")) page1 = ""; out.println(page1); %> <jsp:include page="<%= page1 %>" flush="true" /> In order to get to this page you would have an address like the following: http://127.0.0.1:8080/Operations?page=test.jsp I want to be able to get to this page like this http://127.0.0.1:8080/Operations without getting a Servlet Exception SO in a nutshell it my link address contains a ?page=test.jsp then use it but if it does not just load the page still? Is it possible?
But you might be getting a servlet exception because of your code, not because of mappings...
In your code, you retrive the page parameter, and then make an equals(String) comparison. But if you call the page without ?page=test.jsp, this will throw a null pointer exception, which can be thrown by servlet runners as "servlet exception"... look farther down in your stack trace, you may have a 'root cause: java.lang.NullPointerException' And now I've just noticed that you're seeing if it's null by comparing it to "null". You really mean:
Also, you should consider re-writing it to NOT do the include if it's null.
[This message has been edited by Mike Curwen (edited September 10, 2001).]