>From Cyrille Bonnet
> 
> Hi Jim,
> 
> <script language="javascript" src="functions1.js"/>
> 
> For page1
> 
> And:
> 
> <script language="javascript" src="functions2.js"/>
> 
> For page2.
> 
> (indications on wether to include functions1.js or functions2.js would
be
> included in maverick.xml as a transform)


There are a few ways of doing this.  

Option #1:  Specify a param in maverick.xml

<view path="foo.jsp">
        <transform path="trim.jsp">
                <param name="scriptfile" value="function2.js"/>
        </transform>
</view>

And then in your trim.jsp:

<script language="javascript" src="${scriptfile}"/>


Option #2:  Pass the value from the view jsp to the transform jsp.

Since the view JSP is executed before the transform JSP, you can set
request attributes which are then available when the transform is
executed.  Look at how "title" is passed from welcome.jsp to trim.jsp in
the friendbook-jsp example.

In your foo.jsp:

<c:set var="scriptfile" scope="request">function2.js</c:set>

And then in your trim.jsp:

<script language="javascript" src="${scriptfile}"/>


This provides a reasonable way to pass big blocks of text around.  If
you wanted to, you could use <c:set> to define the entire block of
javascript.  But it's usually good practice to separate out javascript
functions into separate .js files anyways because the browser will cache
it, making each response smaller.

Jeff


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idP47&alloc_id808&op=click
[INVALID FOOTER]

Reply via email to