Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

JSP include and servlet

Thread view: 
aDeamon - 19 Nov 2007 00:14 GMT
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?
Lew - 19 Nov 2007 00:25 GMT
> I have a uniform layout of my jsp-pages with the use of
>         <%@ include file="jspf/prelude.jspf" %>
[quoted text clipped - 21 lines]
> 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.

<http://java.sun.com/javaee/5/docs/tutorial/doc/bnajg.html#bnajl>
> You can implicitly include preludes and codas for a group of
> JSP pages by adding items to the Include Preludes and Codas lists.
[quoted text clipped - 6 lines]
> property group applies to a JSP page, the corresponding elements will be
> processed in the same order as they appear in the JSP configuration section.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.