Hello,

   To be independent from you application name, use

<script language="Javascript1.1"
src="<%=request.getContextPath()%>/staticJavascript.jsp"></script>

   Cedric

Karr, David wrote:

 >I'm trying to build a simple prototype appliction which is using both 
Tiles
 >and Validator.  I got my Tiles code working pretty well, and then I 
started
 >integrating Validator.  I've also gotten this working, but I'm 
wondering if
 >there's a better way to do some of the things I did.
 >
 >I have a "/mainBody.jsp" which is referenced from the Tiles definition.
 >Inside this JSP is the form to be validated.  The path to the layout 
JSP is
 >"/layout/basicLayout.jsp".
 >
 >I have the following line just past the end of my "</form>" tag in
 >"mainBody.jsp":
 >
 ><html:javascript formName="mainForm"
 >                 dynamicJavascript="true" staticJavascript="false"/>
 >
 >I have the following line as the last line before the "</body>" tag in
 >"/layout/basicLayout.jsp":
 >
 ><script language="Javascript1.1"
 >src="/ourapp/staticJavascript.jsp"></script>
 >
 >Where "/ourapp/staticJavascript.jsp" looks like this (taken directly from
 >the struts-validator example):
 >-----------------
 ><%@ page language="java" %>
 ><%-- set document type to Javascript (addresses a bug in Netscape 
according
 >to a web resource --%>
 ><%@ page contentType="application/x-javascript" %>
 ><%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
 >
 ><html:javascript dynamicJavascript="false" staticJavascript="true"/>
 >-----------------
 >
 >So, with this structure, the eventual layed out page has a single 
reference
 >to the static javascript file, and any embedded forms will have embedded
 >references to the dynamic javascript for each form.
 >
 >This structure appears to work.  The only slight nit I have with this 
is the
 >hardcoded reference to the context root of the application name in the
 >"<script>" element in the layout JSP.  I found that just using
 >"/staticJavascript.jps" didn't work.
 >
 >Is this the best way to do this?
 >
 >
 >




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to