JSP include and servlet

A

aDeamon

I have a uniform layout of my jsp-pages with the use of
<%@ include file="jspf/prelude.jspf" %>
and
<%@ include file="jspf/postlude.jspf" %>

The servlets are pritty dirty and output HTML code directly to
response. (I am only working with a prototype - will use of some sort
of framework later on).

My servlets starts with
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("/jspf/prelude.jspf");
dispatcher.include(request, response);

and ends with
dispatcher = getServletContext().getRequestDispatcher("/jspf/
postlude.jspf");
dispatcher.include(request, response);


Now to the problem. In my prelude.jspf I call on a servlet that builds
the navigation-menu with data from a database with
<jsp:include page="GetCategories" flush="false"/>

Everything works fine i my jsp files, but when the Servlet output
pages the servlet in prelude dont run... ??



Any one got a solution for my problem or maybe an alternative way of
doing it?
 
L

Lew

aDeamon said:
I have a uniform layout of my jsp-pages with the use of
<%@ include file="jspf/prelude.jspf" %>
and
<%@ include file="jspf/postlude.jspf" %>

The servlets are pritty dirty and output HTML code directly to
response. (I am only working with a prototype - will use of some sort
of framework later on).

My servlets starts with
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("/jspf/prelude.jspf");
dispatcher.include(request, response);

and ends with
dispatcher = getServletContext().getRequestDispatcher("/jspf/
postlude.jspf");
dispatcher.include(request, response);


Now to the problem. In my prelude.jspf I call on a servlet that builds
the navigation-menu with data from a database with
<jsp:include page="GetCategories" flush="false"/>

Everything works fine in my jsp [sic] files, but when the Servlet [sic] output
pages the servlet in prelude dont run... ??

Is your "jspf" directory hooked directly to the web application directory (its
context)? I notice that you call it with a relative path in the JSP but an
absolute path in the .java servlet.
Any one got a solution for my problem or maybe an alternative way of
doing it?

Consider rewriting the HTML-emitting servlet as a JSP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top