You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Todd Breiholz <tb...@acm.org> on 2004/03/16 03:00:30 UTC

Newbie: Serving css files

Hi all

I started looking at Tapestry a couple of weeks ago and, so far I am 
very impressed. I've run across a small problem that I think is simply 
a configuration issue.

I am trying to use a CSS file, but when I reference my page I do not 
see the styles I defined.

So, I tried to use curl to pull down the CSS file and instead of my CSS 
file, I got my home page.

My home page starts off like this:

<html jwcid="@Shell" title="FileShare Home" 
stylesheet="ognl:assets.stylesheet">
<head jwcid="$remove$">
     <title>File Share Home</title>
      <link rel="stylesheet" type="text/css" href="css/main.css" 
title="style">
</head>

and I have the following in my Home.page file:

     <context-asset name="stylesheet" path="css/main.css"/>

The curl command line was something like this:

   curl http://localhost:8080/css/main.css

The Tapestry ApplicationServlet is configured in my web.xml to serve 
all files:
     <servlet-mapping>
         <servlet-name>fileshare</servlet-name>
         <url-pattern>/</url-pattern>
     </servlet-mapping>

Do I need to put my html files that Tapestry is going to server in one 
directory and configure it in my web.xml and put my other resources 
(css, etc.) in another directory?

TIA

Todd Breiholz


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Newbie: Serving css files

Posted by John Studarus <st...@jhlconsulting.com>.
  Looks like the issue is in your web.xml
  
<servlet-mapping>
  <servlet-name>fileshare</servlet-name>
  <url-pattern>/</url-pattern>                 <----- right here
</servlet-mapping>

  All the requests are going to the servlet and none
of the files are being served up directly by Tomcat.
So, change it to something like:

  <url-pattern>/app</url-pattern>

  Then, request the application at:

  http://hostname:port/fileshare/app

  and your css would be at:

  http://hostname:port/fileshare/css/style.css

        John

  
  
  



On Tue, Mar 16, 2004 at 08:05:07AM -0600, Todd Breiholz wrote:
> John
> 
> Thanks for the info. This is essentially how my app is laid out as 
> well. My .page files are in the WEB-INF directory and my webapp root 
> dir looks like this:
> 
> -rw-r--r--  1 todd  staff  1341 Mar 14 12:16 Home.html
> -rw-r--r--  1 todd  staff   510 Mar 15 19:39 Register.html
> drwxr-xr-x  9 todd  staff   306 Mar 14 12:21 WEB-INF
> drwxr-xr-x  5 todd  staff   170 Mar 14 21:10 css
> 
> with my main.css file in the css directory.
> 
> It seems as if Tapestry is intercepting the request for /css/main.css 
> and is serving my home page instead.
> 
> Todd Breiholz
> 
> On Monday, March 15, 2004, at 08:24 PM, John Studarus wrote:
> 
> >
> >  Basically, static HTML is not pulled out of the same
> >directory as the .page files.  I put the static files
> >in the top directory.  So if you look at:
> >
> >ls /usr/local/tomcat/webapps/my_app
> >
> >images  index.html  META-INF  README  style.css  WEB-INF
> >
> >
> >  Here is how I build it:
> >
> >  From build.xml:
> >    <war warfile="redspin.war" webxml="src/web.xml">
> >      <fileset dir="src/html"/>
> >      <classes dir="classes"/>
> >      <classes dir="db"/>
> >      <webinf dir="WEB-INF"/>
> >      <lib dir="lib"/>
> >    </war>
> >
> >  style.css goes into src/html
> >
> >  In the HTML:
> >
> >   <link rel="stylesheet" href="style.css">
> >
> >
> >        John
> >
> >
> >
> >
> >
> >On Mon, Mar 15, 2004 at 08:00:30PM -0600, Todd Breiholz wrote:
> >>Hi all
> >>
> >>I started looking at Tapestry a couple of weeks ago and, so far I am
> >>very impressed. I've run across a small problem that I think is simply
> >>a configuration issue.
> >>
> >>I am trying to use a CSS file, but when I reference my page I do not
> >>see the styles I defined.
> >>
> >>So, I tried to use curl to pull down the CSS file and instead of my 
> >>CSS
> >>file, I got my home page.
> >>
> >>My home page starts off like this:
> >>
> >><html jwcid="@Shell" title="FileShare Home"
> >>stylesheet="ognl:assets.stylesheet">
> >><head jwcid="$remove$">
> >>    <title>File Share Home</title>
> >>     <link rel="stylesheet" type="text/css" href="css/main.css"
> >>title="style">
> >></head>
> >>
> >>and I have the following in my Home.page file:
> >>
> >>    <context-asset name="stylesheet" path="css/main.css"/>
> >>
> >>The curl command line was something like this:
> >>
> >>  curl http://localhost:8080/css/main.css
> >>
> >>The Tapestry ApplicationServlet is configured in my web.xml to serve
> >>all files:
> >>    <servlet-mapping>
> >>        <servlet-name>fileshare</servlet-name>
> >>        <url-pattern>/</url-pattern>
> >>    </servlet-mapping>
> >>
> >>Do I need to put my html files that Tapestry is going to server in one
> >>directory and configure it in my web.xml and put my other resources
> >>(css, etc.) in another directory?
> >>
> >>TIA
> >>
> >>Todd Breiholz
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Newbie: Serving css files

Posted by Todd Breiholz <tb...@acm.org>.
John

Thanks for the info. This is essentially how my app is laid out as 
well. My .page files are in the WEB-INF directory and my webapp root 
dir looks like this:

-rw-r--r--  1 todd  staff  1341 Mar 14 12:16 Home.html
-rw-r--r--  1 todd  staff   510 Mar 15 19:39 Register.html
drwxr-xr-x  9 todd  staff   306 Mar 14 12:21 WEB-INF
drwxr-xr-x  5 todd  staff   170 Mar 14 21:10 css

with my main.css file in the css directory.

It seems as if Tapestry is intercepting the request for /css/main.css 
and is serving my home page instead.

Todd Breiholz

On Monday, March 15, 2004, at 08:24 PM, John Studarus wrote:

>
>   Basically, static HTML is not pulled out of the same
> directory as the .page files.  I put the static files
> in the top directory.  So if you look at:
>
> ls /usr/local/tomcat/webapps/my_app
>
> images  index.html  META-INF  README  style.css  WEB-INF
>
>
>   Here is how I build it:
>
>   From build.xml:
>     <war warfile="redspin.war" webxml="src/web.xml">
>       <fileset dir="src/html"/>
>       <classes dir="classes"/>
>       <classes dir="db"/>
>       <webinf dir="WEB-INF"/>
>       <lib dir="lib"/>
>     </war>
>
>   style.css goes into src/html
>
>   In the HTML:
>
>    <link rel="stylesheet" href="style.css">
>
>
>         John
>
>
>
>
>
> On Mon, Mar 15, 2004 at 08:00:30PM -0600, Todd Breiholz wrote:
>> Hi all
>>
>> I started looking at Tapestry a couple of weeks ago and, so far I am
>> very impressed. I've run across a small problem that I think is simply
>> a configuration issue.
>>
>> I am trying to use a CSS file, but when I reference my page I do not
>> see the styles I defined.
>>
>> So, I tried to use curl to pull down the CSS file and instead of my 
>> CSS
>> file, I got my home page.
>>
>> My home page starts off like this:
>>
>> <html jwcid="@Shell" title="FileShare Home"
>> stylesheet="ognl:assets.stylesheet">
>> <head jwcid="$remove$">
>>     <title>File Share Home</title>
>>      <link rel="stylesheet" type="text/css" href="css/main.css"
>> title="style">
>> </head>
>>
>> and I have the following in my Home.page file:
>>
>>     <context-asset name="stylesheet" path="css/main.css"/>
>>
>> The curl command line was something like this:
>>
>>   curl http://localhost:8080/css/main.css
>>
>> The Tapestry ApplicationServlet is configured in my web.xml to serve
>> all files:
>>     <servlet-mapping>
>>         <servlet-name>fileshare</servlet-name>
>>         <url-pattern>/</url-pattern>
>>     </servlet-mapping>
>>
>> Do I need to put my html files that Tapestry is going to server in one
>> directory and configure it in my web.xml and put my other resources
>> (css, etc.) in another directory?
>>
>> TIA
>>
>> Todd Breiholz
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Newbie: Serving css files

Posted by John Studarus <st...@jhlconsulting.com>.
  Basically, static HTML is not pulled out of the same
directory as the .page files.  I put the static files
in the top directory.  So if you look at:

ls /usr/local/tomcat/webapps/my_app

images  index.html  META-INF  README  style.css  WEB-INF

  
  Here is how I build it:

  From build.xml:
    <war warfile="redspin.war" webxml="src/web.xml">
      <fileset dir="src/html"/>
      <classes dir="classes"/>
      <classes dir="db"/>
      <webinf dir="WEB-INF"/>
      <lib dir="lib"/>
    </war>

  style.css goes into src/html

  In the HTML:

   <link rel="stylesheet" href="style.css">


        John





On Mon, Mar 15, 2004 at 08:00:30PM -0600, Todd Breiholz wrote:
> Hi all
> 
> I started looking at Tapestry a couple of weeks ago and, so far I am 
> very impressed. I've run across a small problem that I think is simply 
> a configuration issue.
> 
> I am trying to use a CSS file, but when I reference my page I do not 
> see the styles I defined.
> 
> So, I tried to use curl to pull down the CSS file and instead of my CSS 
> file, I got my home page.
> 
> My home page starts off like this:
> 
> <html jwcid="@Shell" title="FileShare Home" 
> stylesheet="ognl:assets.stylesheet">
> <head jwcid="$remove$">
>     <title>File Share Home</title>
>      <link rel="stylesheet" type="text/css" href="css/main.css" 
> title="style">
> </head>
> 
> and I have the following in my Home.page file:
> 
>     <context-asset name="stylesheet" path="css/main.css"/>
> 
> The curl command line was something like this:
> 
>   curl http://localhost:8080/css/main.css
> 
> The Tapestry ApplicationServlet is configured in my web.xml to serve 
> all files:
>     <servlet-mapping>
>         <servlet-name>fileshare</servlet-name>
>         <url-pattern>/</url-pattern>
>     </servlet-mapping>
> 
> Do I need to put my html files that Tapestry is going to server in one 
> directory and configure it in my web.xml and put my other resources 
> (css, etc.) in another directory?
> 
> TIA
> 
> Todd Breiholz
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org