SV: Relative paths Clay

2007-02-23 Thread Hermod Opstvedt
Hi

By the way, there is a Tomahawk sandbox component for the link (tx:link?).

Hermod


-Opprinnelig melding-
Fra: Richard Eggert [mailto:[EMAIL PROTECTED] 
Sendt: 23. februar 2007 16:19
Til: user@shale.apache.org
Emne: RE: Relative paths  Clay

Thanks.  Those ideas worked great.  Here's what I ended up doing to make
them reusable:


component jsfid=sym:graphicImage extends=h:graphicImage
   attributes
  set name=url value=@imageUrl /
   /attributes
   symbols
  set name=imageUrl value=@src /
  set name=src /
   /symbols
/component

component jsfid=sym:headerLink extends=clayOut
   attributes
  set name=escapeXml value=false /
  set 
 name=value 
 value=lt;link type=quot;@typequot; rel=quot;@relquot;
href=quot;@linkUrlquot; /gt;
  /
   /attributes
   symbols
  set name=type /
  set name=rel /
  set name=linkUrl value=@href /
  set name=href /
   /symbols
/component


link jsfid=sym:headerLink rel=stylesheet type=text/css
linkUrl=./path/to/style.css href=style.css /


img jsfid=sym:graphicImage src=../../images/bar.jpg
imageUrl=images/bar.jpg /




Rich Eggert
Member of Technical Staff
Proteus Technologies, LLC
http://www.proteus-technologies.com



-Original Message-
From: Gary VanMatre [mailto:[EMAIL PROTECTED]
Sent: Thu 2/22/2007 5:48 PM
To: user@shale.apache.org
Subject: Re: Relative paths  Clay
 
From: Richard Eggert [EMAIL PROTECTED] 

 I've run into a very basic problem using Clay that I'm not sure how to
solve. 
 
 Here's the setup: 
 
 I have a JSP file (we'll call it page.jsp) that contains a single tag 
 that points to an HTML template in a subdirectory (we'll call it 
 /templates/blah/foo.html). The HTML template references an image file in a

 completely different directory (/images/bar.jpg). 
 
 How do I get the image to display properly both when rendered by Clay and
when 
 just loaded as a mockup? 
 
 When loaded through the JSP using Clay, the image file's relative path is 
 images/bar.jpg. However, when the HTML is loaded directly with a browser
either 
 online or offline, the image file's relative path is instead 
 ../../images/bar.jpg. 
 
 Using the absolute path (/appName/images/bar.jpg) works for both forms of
online 
 viewing (via JSP and as mockup), but it doesn't work for offline viewing
(since 
 the absolute path then becomes
/full/filesystem/path/to/appName/images/bar.jpg), 
 and I'd also rather not hard-code my application's context root into my
HTML. 
 
 I thought of using a tag with jsfid=void, but that doesn't work, since 
 only accepts full URL's and not relative paths. 
 
 Does anyone know of a way around this? 


You might try something like this:

component jsfid=imageBar extends=h:graphicImage
   attributes
set name=url value=/images/bar.jpg/
   /attributes
/component

img jsfid=imageBar src=/appName/images/bar.jpg/ 

 
 Incidentally, the same issue arises with links to stylesheets. 



You would be better off looking for a component, but something like this
might work too:

component jsfid=mycssLink extends=clay:clayOut
   attributes
set name=excapeXml value=false/
set name=value value=lt;link jsfid=quot;mycssLinkquot;
type=quot;text/cssquot; rel=quot;stylesheetquot; id=quot;csslinkquot;
href=quot;/mycss.cssquot;  /gt;/
   /attributes
/component


link jsfid=mycssLink type=text/css rel=stylesheet id=csslink
href=/appName/images/mycss.css  /


Another option would be to use the comment blocks to remove the CSS used for
developement.

!-- ### clay:remove ### --
link type=text/css rel=stylesheet id=csslink
href=/appName/images/mycss.css  /
!-- ### /clay:remove ### --
link type=text/css rel=stylesheet id=csslink href=/mycss.css  /
 
 
 Rich Eggert 
 Member of Technical Staff 
 Proteus Technologies, LLC 
 http://www.proteus-technologies.com 
 
 

Gary




Relative paths Clay

2007-02-22 Thread Richard Eggert
I've run into a very basic problem using Clay that I'm not sure how to solve.

Here's the setup:

I have a JSP file (we'll call it page.jsp) that contains a single clay tag 
that points to an HTML template in a subdirectory (we'll call it 
/templates/blah/foo.html).  The HTML template references an image file in a 
completely different directory (/images/bar.jpg).

How do I get the image to display properly both when rendered by Clay and when 
just loaded as a mockup?

When loaded through the JSP using Clay, the image file's relative path is 
images/bar.jpg.  However, when the HTML is loaded directly with a browser 
either online or offline, the image file's relative path is instead 
../../images/bar.jpg.

Using the absolute path (/appName/images/bar.jpg) works for both forms of 
online viewing (via JSP and as mockup), but it doesn't work for offline viewing 
(since the absolute path then becomes 
/full/filesystem/path/to/appName/images/bar.jpg), and I'd also rather not 
hard-code my application's context root into my HTML.

I thought of using a base tag with jsfid=void, but that doesn't work, since 
base only accepts full URL's and not relative paths.

Does anyone know of a way around this?  

Incidentally, the same issue arises with links to stylesheets.
 

Rich Eggert
Member of Technical Staff
Proteus Technologies, LLC
http://www.proteus-technologies.com



SV: Relative paths Clay

2007-02-22 Thread Hermod Opstvedt
Hi

Short answer: You don't. What I do is add a duplicate entry around such
stuff using the Clay html remove stuff

!-- ### clay:remove ### --

What comes here will be removed by clay, but displayed by a browser

!-- ### /clay:remove ### --

Hermod


-Opprinnelig melding-
Fra: Richard Eggert [mailto:[EMAIL PROTECTED] 
Sendt: 22. februar 2007 22:30
Til: user@shale.apache.org
Emne: Relative paths  Clay

I've run into a very basic problem using Clay that I'm not sure how to
solve.

Here's the setup:

I have a JSP file (we'll call it page.jsp) that contains a single clay tag
that points to an HTML template in a subdirectory (we'll call it
/templates/blah/foo.html).  The HTML template references an image file in a
completely different directory (/images/bar.jpg).

How do I get the image to display properly both when rendered by Clay and
when just loaded as a mockup?

When loaded through the JSP using Clay, the image file's relative path is
images/bar.jpg.  However, when the HTML is loaded directly with a browser
either online or offline, the image file's relative path is instead
../../images/bar.jpg.

Using the absolute path (/appName/images/bar.jpg) works for both forms of
online viewing (via JSP and as mockup), but it doesn't work for offline
viewing (since the absolute path then becomes
/full/filesystem/path/to/appName/images/bar.jpg), and I'd also rather not
hard-code my application's context root into my HTML.

I thought of using a base tag with jsfid=void, but that doesn't work,
since base only accepts full URL's and not relative paths.

Does anyone know of a way around this?  

Incidentally, the same issue arises with links to stylesheets.
 

Rich Eggert
Member of Technical Staff
Proteus Technologies, LLC
http://www.proteus-technologies.com




Re: Relative paths Clay

2007-02-22 Thread Gary VanMatre
From: Richard Eggert [EMAIL PROTECTED] 

 I've run into a very basic problem using Clay that I'm not sure how to solve. 
 
 Here's the setup: 
 
 I have a JSP file (we'll call it page.jsp) that contains a single tag 
 that points to an HTML template in a subdirectory (we'll call it 
 /templates/blah/foo.html). The HTML template references an image file in a 
 completely different directory (/images/bar.jpg). 
 
 How do I get the image to display properly both when rendered by Clay and 
 when 
 just loaded as a mockup? 
 
 When loaded through the JSP using Clay, the image file's relative path is 
 images/bar.jpg. However, when the HTML is loaded directly with a browser 
 either 
 online or offline, the image file's relative path is instead 
 ../../images/bar.jpg. 
 
 Using the absolute path (/appName/images/bar.jpg) works for both forms of 
 online 
 viewing (via JSP and as mockup), but it doesn't work for offline viewing 
 (since 
 the absolute path then becomes 
 /full/filesystem/path/to/appName/images/bar.jpg), 
 and I'd also rather not hard-code my application's context root into my HTML. 
 
 I thought of using a tag with jsfid=void, but that doesn't work, since 
 only accepts full URL's and not relative paths. 
 
 Does anyone know of a way around this? 


You might try something like this:

component jsfid=imageBar extends=h:graphicImage
   attributes
set name=url value=/images/bar.jpg/
   /attributes
/component

img jsfid=imageBar src=/appName/images/bar.jpg/ 

 
 Incidentally, the same issue arises with links to stylesheets. 



You would be better off looking for a component, but something like this might 
work too:

component jsfid=mycssLink extends=clay:clayOut
   attributes
set name=excapeXml value=false/
set name=value value=lt;link jsfid=quot;mycssLinkquot; 
type=quot;text/cssquot; rel=quot;stylesheetquot; id=quot;csslinkquot; 
href=quot;/mycss.cssquot;  /gt;/
   /attributes
/component


link jsfid=mycssLink type=text/css rel=stylesheet id=csslink 
href=/appName/images/mycss.css  /


Another option would be to use the comment blocks to remove the CSS used for 
developement.

!-- ### clay:remove ### --
link type=text/css rel=stylesheet id=csslink 
href=/appName/images/mycss.css  /
!-- ### /clay:remove ### --
link type=text/css rel=stylesheet id=csslink href=/mycss.css  /
 
 
 Rich Eggert 
 Member of Technical Staff 
 Proteus Technologies, LLC 
 http://www.proteus-technologies.com 
 
 

Gary