Hi- I have a Servlet (call it Primary) that invokes a JSP using:

    getServletContext().getRequestDispatcher(myJSP).forward(req, res);

This works fine. However, myJSP includes four Javascripts using the
following syntax (one for each Javascript):

    <script language="javascript"
src="/displayDir/<%=projectDir%>/js/myJS1.js" >  </script>

myJSP seems to be served up just fine. But then, for each inserted
script (with the above script language statement), the Primary Servlet
is invoked again. For these subsequent invocations, I have found that I
need to check the url to see if its correct (it contains the js path and
name) and if not, create a printwriter:

    PrintWriter pr = res.getWriter();

and return. If I do not create the printwriter, then no output is sent
to the browser. I do not need to write anything to pr, or close it.

So, bottom line, I can get it to all work, but the Primary Servlet is
being called four more times than necessary (which I think would impact
performance) and what I've ended up doing seems a hack at best.

I have to think I'm not approaching the problem correctly. I'm using
Weblogic 4.5.1. Thanks for your help. -ted

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to