Instead of using $getURI just use
<script language="JavaScript"
src="$data.Request.ContextPath/resources/js/formTest.js"></script>
And you'll be fine. getURI has a little problem with all the quotes
sometimes.
If you want to use getURI and you discover that the function doesn't replace
anything in the resulting HTML say soimething like.
<script language='JavaScript'
src='$content.getURI("/resources/js/formTest.js"'></script>
so you don't have conflicting quotes. Sometimes java get a little confused i
think.
Diederik
-----Oorspronkelijk bericht-----
Van: David Wynter [mailto:[EMAIL PROTECTED]]
Verzonden: dinsdag 16 april 2002 14:19
Aan: Turbine Users List
Onderwerp: RE: Finding path to resource
I should have said consistency from the perspective that the getURI calls
worked when I had a flat directory structure;
app---
|-layout
|-navigation
|-screens
But no longer work now that I have a structure that reflect the roles of the
folk that use the application.
app---
|-layout
| |-Admin
| |-MsgUser
| |-ExtractUser
|
|-navigation
| |-Admin
| |-MsgUser
| |-ExtractUser
|
|-screens
|-Admin
|-MsgUser
|-ExtractUser
Before I had a single layout for the single role in the system called
Default.vm in the layouts directory. Now I have 3 Default.vm's in each of
the role specific subdirectories. And so on for navigation. The screen
templates used to be in the screens directory and are now in the role
specific subdirectory. That this should change the behaviour of getURI I
find difficult to understand.
David
-----Original Message-----
From: Age Mooy [mailto:[EMAIL PROTECTED]]
Sent: 16 April 2002 13:00
To: Turbine Users List
Subject: RE: Finding path to resource
$content.getURI() has a different function than $link.setPage() so
consistency doesn't come into it. The $content tool is for getting urls
relative to the app context (/myapp). The $link tool builds urls relative to
the template search path.
> -----Original Message-----
> From: David Wynter [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 16, 2002 13:51
> To: Turbine Users List
> Subject: RE: Finding path to resource
>
>
> Sorry, I misunderstood what you said below. When I use View
> source the HTML
> does show up!
>
> And it shows that the result from getURI seems to have changed
>
> I get
> <tr>
> <td><img border="0"
> src="http://localhost:8080/rwtransform/images/trans_8phigh.gif" alt="trans
> spacer"
> height="8" width="5"></td>
> </tr>
>
> from
>
> <tr>
> <td><img border="0" src="$content.getURI("images/trans_8phigh.gif")"
> alt="trans spacer"
> height="8" width="5"></td>
> </tr>
> in the template for the menu.
>
> Whereas I get
> <map name="srchelp">
> <AREA shape="rect" coords="127,0,157,20"
> href="http://localhost:8080/rwtransform/servlet/rwtransform/templa
> te/Admin%2
> Chelpsrcsnk.vm" alt="Help on Sources and Sinks" >
> </map>
>
> from
>
> <map name="srchelp">
> <AREA shape="rect" coords="127,0,157,20"
> href="$link.setPage("Admin,helpsrcsnk.vm")" alt="Help on Sources
> and Sinks"
> >
> </map>
>
> The getURI method seems to be leaving out the
> "/rwtransform/servlet" Seems
> fairly inconsistent? Also how come this worked before. None of
> the getURI's
> changed from when I had them in "/layouts" directory compared to now in
> "/layout/Admin" direcotry???
>
> David
> -----Original Message-----
> From: David Wynter [mailto:[EMAIL PROTECTED]]
> Sent: 16 April 2002 12:31
> To: Turbine Users List
> Subject: RE: Finding path to resource
>
>
> No, the screen comes up blank, with or without /> or /script> closing the
> statement.
>
> -----Original Message-----
> From: Age Mooy [mailto:[EMAIL PROTECTED]]
> Sent: 16 April 2002 12:23
> To: Turbine Users List
> Subject: RE: Finding path to resource
>
>
>
> Try using a </script> to close your script tag. The <script/> syntax is
> xhtml and might not be understood by your browser. Does the
> complete source
> of your screen show up in "view source" ?
>
> Age
>
>
> > -----Original Message-----
> > From: David Wynter [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, April 16, 2002 13:12
> > To: Turbine Users List
> > Subject: RE: Finding path to resource
> >
> >
> > To answer part of my own question. $page.setStyleSheet() is a part of
> > VelocityECSLayout features. I replaced the line with it below with
> > <LINK REL="STYLESHEET" TYPE="text/css" HREF="$styleSheet">
> > and I have my stylesheet working again.
> >
> > But I still have no idea why it I get a blank screen when I
> > include the line
> > <SCRIPT LANGUAGE="JavaScript"
> > src="$content.getURI("resources/global.js")"/>
> > in between my <HEAD> tags. The script in global.js has not been touched
> > since it was last working with my flat directory structure. Any ideas?
> >
> > David
> >
> > -----Original Message-----
> > From: David Wynter [mailto:[EMAIL PROTECTED]]
> > Sent: 16 April 2002 11:56
> > To: Turbine Users List
> > Subject: RE: Finding path to resource
> >
> >
> > Er actually it does not work. Using the layout template below for my
> > layout/Admin/Default.vm I get a blank screen. If I remove the
> <SCRIPT ....
> > statement I get the correct screen but have lost the stylesheet.
> > So I assume
> > that the facilities such as
> >
> > > #set ( $fileName="style.css.${detector}")
> > > #set ( $styleSheet=$content.getURI("resources/${fileName}"))
> > > $page.setStyleSheet($styleSheet)
> >
> > are no longer available to me when using VelocityOnlyLayout?
> Maybe some of
> > these statements are the 'nice features' of VelocityECSLayout you
> > lose when
> > adopting VelocityOnlyLayout I have seen mentioned in the archives.
> >
> > After a bit more reading I moved the stylesheet setting
> > statements to inside
> > the <HEAD> tags. I also traced on 'getURI' and that is setting
> the correct
> > URI for the resources. I can only assume that setStyleSheet is
> specific to
> > VelocityECSLayout, is the $page specific to VelocityECSLayout? Since the
> > index on the Javadoc is broken just above this entry I have not
> > been able to
> > find which class has this function.
> >
> > So I am still exactly where I was before, very frustrating.
> >
> > David
> >
> > -----Original Message-----
> > From: Simon Moore [mailto:[EMAIL PROTECTED]]
> > Sent: 16 April 2002 10:24
> > To: Turbine Users List
> > Subject: RE: Finding path to resource
> >
> >
> > yep...that should do it...
> >
> > (remember to either set you layout to be default in tr.props or
> set it on
> > the fly....)
> >
> > saimon
> >
> > > -----Mensaje original-----
> > > De: David Wynter [SMTP:[EMAIL PROTECTED]]
> > > Enviado el: martes 16 de abril de 2002 11:16
> > > Para: Turbine Users List
> > > Asunto: RE: Finding path to resource
> > >
> > > Hi,
> > >
> > > I had been avoiding that as in the archives quite a few folk say that
> > > VelocityECSLayout has functions that will be missed if you
> change. What
> > > these functions are, I am not sure but hey I didn't want to
> move to far
> > > away
> > > from something that was working really well.
> > >
> > > I assume I just need to change my Layout template Default.vm
> in each of
> > > the
> > > subdirectories under /layout directory. Thus:
> > >
> > > <HTML>
> > > <HEAD>
> > > <TITLE>......</TITLE>
> > > <SCRIPT LANGUAGE="JavaScript"
> > > src="$content.getURI("resources/global.js")"/>
> > > </HEAD>
> > > <BODY>
> > > #set ( $fileName="style.css.${detector}")
> > > #set ( $styleSheet=$content.getURI("resources/${fileName}"))
> > > $page.setStyleSheet($styleSheet)
> > >
> > > <table width="$ui.totalLayoutWidth" cellspacing="5">
> > > <tr>
> > > <td colspan="3">
> > > $navigation.setTemplate("/DefaultTop.vm")
> > > </td>
> > > </tr>
> > > <tr>
> > > <td width="$ui.menuWidth" align="left" valign="top">
> > > $navigation.setTemplate("/Admin/Default.vm")
> > > </td>
> > > <td BGCOLOR="#86BE40" width="1">
> > > <img src="$content.getURI("images/apixltgrn.gif")"
> > > height="100%"
> > > width="1">
> > > </td>
> > > <td align="left" valign="top" width="$ui.screenTableWidth">
> > > $screen_placeholder
> > > </td>
> > > </tr>
> > > <tr>
> > > <td colspan="3">
> > > $navigation.setTemplate("/DefaultBottom.vm")
> > > </td>
> > > </tr>
> > > </table>
> > > </BODY>
> > > </HTML>
> > >
> > > Note that ${detector} is used to determine th ebrowser type and
> > substitute
> > > the corect style sheet for th ebrowser.
> > >
> > > Thansk
> > >
> > > David
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Diederik de Groot [mailto:[EMAIL PROTECTED]]
> > > Sent: 16 April 2002 09:47
> > > To: 'Turbine Users List'
> > > Subject: RE: Finding path to resource
> > >
> > >
> > > Aha, Maybe you have set Verlocity ro ECS in stead of HTML
> > >
> > > ECS is depreceated and soon to go away. Please setup Velocity
> > to use HTML
> > > Only. Go to TurbineResource.properties and search for
> VelocityECSLayout,
> > > and
> > > change it to VelocityOnlyLayout. No you will have to add
> > <html><body> etc
> > > to
> > > your templates but you will be a lot more flexible in the
> statements you
> > > want to use.
> > >
> > > ECS is not supported after 2.2b1 i think,
> > >
> > > Diederik
> > >
> > >
> > >
> > >
> > >
> > > -----Oorspronkelijk bericht-----
> > > Van: David Wynter [mailto:[EMAIL PROTECTED]]
> > > Verzonden: Monday, April 15, 2002 6:02 PM
> > > Aan: Turbine Users List
> > > Onderwerp: RE: Finding path to resource
> > >
> > >
> > > Diederik,
> > >
> > > I still get the same result a blank screen. I am starting to
> think it is
> > > something else? If I take out the lines
> > > <script language="JavaScript"
> > > src="$data.Request.ContextPath/resources/global.js"></script>
> > >
> > > I get an error in the page when it tries to use the
> JavaScript function
> > > after I service the onClick event because it cannot find the
> JavaScript
> > > function in the screen, but at least the screen shows up and
> works up to
> > > that point.
> > >
> > > I am a loss to explain this.
> > >
> > > David
> > >
> > >
> > > -----Original Message-----
> > > From: Diederik de Groot [mailto:[EMAIL PROTECTED]]
> > > Sent: 15 April 2002 16:26
> > > To: 'Turbine Users List'
> > > Subject: RE: Finding path to resource
> > >
> > >
> > > Hi David,
> > >
> > > The following line works fine for me. Just put this in a
> Screen VM file
> > > and
> > > you can access the js file. It a bit of a lowlevel connection
> > but sure to
> > > work.
> > >
> > > <script language="JavaScript"
> > > src="$data.Request.ContextPath/resources/js/formTest.js"></script>
> > >
> > > Greetings,
> > >
> > > Diederik
> > >
> > > -----Oorspronkelijk bericht-----
> > > Van: David Wynter [mailto:[EMAIL PROTECTED]]
> > > Verzonden: Monday, April 15, 2002 4:48 PM
> > > Aan: Turbine Users List
> > > Onderwerp: RE: Finding path to resource
> > >
> > >
> > > Saimon,
> > >
> > > Sure, if it shows me how to include the JavaScript from a
> template in a
> > > sub
> > > directory off /screens. I have found the architecture hard to follow,
> > > mainly
> > > because of the documentation. I have found the Flux implementation has
> > > answered most of my questions when someone reminded me it was there!
> > >
> > > David
> > >
> > > -----Original Message-----
> > > From: Simon Moore [mailto:[EMAIL PROTECTED]]
> > > Sent: 15 April 2002 15:37
> > > To: Turbine Users List
> > > Subject: RE: Finding path to resource
> > >
> > >
> > > I submitted a javascript implementation for intake a while back
> > now, that
> > > you might be interested in...
> > >
> > > If so..I'll see if I can dig it up...
> > >
> > > Saimon
> > >
> > > > -----Mensaje original-----
> > > > De: David Wynter [SMTP:[EMAIL PROTECTED]]
> > > > Enviado el: lunes 15 de abril de 2002 16:31
> > > > Para: Turbine-User
> > > > Asunto: Finding path to resource
> > > >
> > > > I have just moved my .vm templates to subdirectories of
> > > > webapps/myapp/modules/app/screens that represent the roles that use
> > > them.
> > > > I
> > > > have implemented a much simpler version of what Scott
> Weaver presented
> > > in
> > > > his extended security model. The last hurdle to overcome is
> finding my
> > > > JavaScript resources. I have a file 'global.js' located in the
> > > > webapps/myapp/resources directory. In this global.js file is
> > a function
> > > > called comparePwds. It is address from a tempalte as follows:
> > > > <input type="submit" name="eventSubmit_doCreate" value="Create"
> > > > onClick="comparePwds(this.form)"/>
> > > >
> > > > It cannot find it now that the template has moved to
> > > > webapps/myapp/modules/app/screens/Admin.
> > > >
> > > > I tried adding this to the top of the template and separately
> > to the top
> > > > of
> > > > the layout template.
> > > > <script language="JavaScript"
> > > > src="$content.getURI("resources/global.js")"/>
> > > > I ended up with blank screens in both cases but no error about not
> > > finding
> > > > the script. I found a reference to this is in the arhive,
> > but this had
> > > > <html> and <body> tags which my templates do not. I could not find
> > > > anything
> > > > on where these tags are implicitly in the Velocity templates. I
> > > understand
> > > > that I need to put the above <script ... in between the <html> and
> > > <body>
> > > > tags but where do these occur?
> > > >
> > > > thanks
> > > >
> > > > David Wynter
> > > > roamware Ltd.
> > > > (+44) (0) 208 922 7539 B.
> > > > (+44) (0) 7879 605 706 M.
> > > > [EMAIL PROTECTED]
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>