By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,740 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,740 IT Pros & Developers. It's quick & easy.

jsp:include and servlets

P: n/a
hello,

I have the following problem:

I would like to evacuate the logic from my jsp files in servlets. servlets
provide database contents prepared in HTML tables, the jsp files are
supposed to offer the graphic structure of the intranet application.

how does the path detail have to look?

thats my current include command:

<%@ include file="/proj/mdswpu/classes/ShowList" flush="true" %>

the whole thing is located in the directory webapps/Root/weave INF/classes.

do the path details cause problems or is it due to the servlet? is it no
matter whether doPost or doGet method is used?
the servlet delivers HTML via printwriter.

thank you for the help in advance ....
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Sascha,
It seems that your JSP is the one that is getting the initial request.
Turn this around - let your servlet get the initial request, which will
then route it to appropriate JSP file. Here is some code of how to send
request from a servlet to JSP.
String fileName = "/YourJSPFile.jsp"; //Make sure to start this with a slash
RequestDispatcher reqDisp =
servlet.getServletConfig().getServletContext().get RequestDispatcher(fileName);

if(reqDisp == null){
System.out.println("RequestDispatcher is null. Check if the file
name begin with a slash in the calling function.");
return;
}

reqDisp.forward(request, response);
Ideally, you should set aside one servlet that accepts all the calls
from your client. Check the FrontController pattern in the J2EE Design
Patterns book.

KB
--
------------------------------------------------------------------------
This email is certified to be Spam free by Spam Marshall

You don't pay to get spam, why pay to clean it?
Visit http://www.spammarshall.com to create an account for free
<http://www.spammarshall.com>

------------------------------------------------------------------------
Sascha Pohlmann wrote:
hello,

I have the following problem:

I would like to evacuate the logic from my jsp files in servlets. servlets
provide database contents prepared in HTML tables, the jsp files are
supposed to offer the graphic structure of the intranet application.

how does the path detail have to look?

thats my current include command:

<%@ include file="/proj/mdswpu/classes/ShowList" flush="true" %>

the whole thing is located in the directory webapps/Root/weave INF/classes.

do the path details cause problems or is it due to the servlet? is it no
matter whether doPost or doGet method is used?
the servlet delivers HTML via printwriter.

thank you for the help in advance ....

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.